Skip to content

fix: keep user client config when switching to direct connect endpoint - #1291

Open
Dor-bl wants to merge 1 commit into
appium:masterfrom
Dor-bl:fix/direct-connect-client-config
Open

fix: keep user client config when switching to direct connect endpoint#1291
Dor-bl wants to merge 1 commit into
appium:masterfrom
Dor-bl:fix/direct-connect-client-config

Conversation

@Dor-bl

@Dor-bl Dor-bl commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Description

When the Appium server decorates the new session response with directConnect* capabilities, the client rebuilt its command executor out of the endpoint URL alone. That silently dropped every setting of the AppiumClientConfig supplied by the user—including timeout, init_args_for_pool_manager, proxy, CA bundle, and authentication credentials—and downgraded the config instance to a default Selenium ClientConfig.

The most visible consequence was that configuring a read timeout had no effect on sessions redirected via direct connect, causing requests to hang indefinitely if the endpoint became unresponsive.

This PR ensures the client reuses a copy of the existing client_config and only replaces the endpoint URL (remote_server_addr). Copying ensures the user-provided instance remains unmodified, while also avoiding the deprecated remote_server_addr/keep_alive constructor arguments of RemoteConnection.

Closes #855

Changes

  • appium/webdriver/webdriver.py: In _update_command_executor, copy self.command_executor.client_config, update remote_server_addr and keep_alive, and pass client_config to AppiumConnection / RemoteConnection.
  • test/unit/webdriver/webdriver_test.py: Add test_create_session_register_uridirect_keeps_client_config verifying that timeout, username, password, user_agent, init_args_for_pool_manager, and direct_connection persist after direct connect endpoint update.
  • README.md: Clarify that custom client_config parameters are retained across direct connect switches.

When the server decorates the new session response with directConnect* capabilities, the client rebuilt its command executor out of the endpoint URL alone. That silently dropped all settings from the user-provided AppiumClientConfig, including read timeout, pool manager arguments, proxy, CA bundle, and authentication credentials, downgrading the config instance to a plain selenium ClientConfig.

The most visible consequence was that configuring a read timeout had no effect on such sessions, allowing hanging server calls to never time out.

Reuse a copy of the current configuration and update the endpoint URL instead. Copying preserves the original instance given by the user, while also avoiding the deprecated remote_server_addr/keep_alive arguments of RemoteConnection.

Closes appium#855
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Unable to timeout find_elements and webdriver.Remote

1 participant