Repository navigation
Conversation
waitForQuiescence is a boolean XCUITest capability and the getter returns bool, but the setter was annotated as accepting timedelta | float, copied from the timeout options. Type checkers therefore accepted a timedelta, which cannot be serialized when the session is created. Annotate the setter as bool and drop the unused timedelta import. Claude-Session: https://claude.ai/code/session_01K6zVKi1DtwmmBpy16MQyfY Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The flutter_element_wait_timeout and flutter_server_launch_timeout getters are annotated and documented to return a timedelta, and their setters accept one, but the getters returned the raw capability value in milliseconds. So setting timedelta(seconds=10) and reading it back gave 10000. Convert the stored milliseconds to a timedelta, like the other timeout options do. Claude-Session: https://claude.ai/code/session_01K6zVKi1DtwmmBpy16MQyfY Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
AppiumConnection.get_remote_connection_headers was a plain classmethod, so the super() call always resolved Selenium's headers on the class and never on the connection instance. Since Selenium 4.51 a connection keeps the user_agent and extra_headers from its client config on the instance, so AppiumClientConfig(extra_headers=..., user_agent=...) had no effect for AppiumConnection, while RemoteConnection sent them. Bind the method to the instance when called on one, like Selenium does. The idempotency key is still added only to the headers returned for a new session request, as in appium#1338, and the method no longer rewrites the class-level extra_headers dict on other requests. Calling the method on the class keeps working. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MattL1989
force-pushed
the
fix/appium-connection-client-config-headers
branch
from
October 31, 2026 14:49
c36258b to
d051830
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
extra_headersanduser_agentset on anAppiumClientConfig(or SeleniumClientConfig) are never sent when the connection is anAppiumConnection, which is the default forwebdriver.Remote:A plain Selenium
RemoteConnectionwith the same config sends both.Why it happens. Since Selenium 4.51, the minimum version this client requires:
RemoteConnectionkeeps each connection'suser_agentandextra_headerson the instance.get_remote_connection_headersis bound with a_classorinstancemethoddescriptor so that it reads those instance values.AppiumConnectionoverrides that method as a plain@classmethod. As a result, itssuper()call always resolves the headers on the class and never sees the connection's own config.Second effect of the same override. The
X-Idempotency-Keyfor a new-session request was written into the class-levelAppiumConnection.extra_headersdict, then removed again by the next request. That dict is shared by every connection and thread. When two sessions are created at the same time, they can share the same key or lose it. The key exists to let the server de-duplicate a repeated new-session request.Fix
AppiumConnection.get_remote_connection_headersthe same way Selenium does: to the instance when called on one, otherwise to the class.AppiumConnection.get_remote_connection_headers(...)on the class keeps working. So do subclasses that override it as a classmethod and callsuper().Behaviour change: a
user_agentset in the client config now replaces the defaultappium/...user agent, as it does for Selenium'sRemoteConnection. Without one, the Appium user agent is sent as before.Tests
test_remove_headers_case_insensitiveasserted that the class-level dict was cleaned up. It now checks that the returned headers contain no stale key. AtearDownresets the class attribute the tests modify.X-Tenantand the customUser-Agentare now sent on the new-session request and on later commands.ruff check,ruff format --check,mypy appiumand the full unit test suite pass.Generated by Claude Code