Conversation
|
When will this PR be merged? |
appium/webdriver/webdriver.py
Outdated
| client_config: Optional[ClientConfig] = None, | ||
| client_config: Optional[AppiumClientConfig] = None, | ||
| ): | ||
| if isinstance(command_executor, str): |
There was a problem hiding this comment.
would it be possible to extract this logic into a separate method, so super class init would be the very first call there?
There was a problem hiding this comment.
super class init would be the very first call there?
Actually we could by modifying here like below:
def __init__(
self,
command_executor: AppiumConnection,
client_config: AppiumClientConfig,
extensions: Optional[List['WebDriver']] = None,
file_detector: Optional[FileDetector] = None,
options: Union[AppiumOptions, List[AppiumOptions], None] = None,
):
Then, a new method will help to build client_config and command_executor.
To avoid handling string of command_executor in selenium, which uses ClientConfig, I have added these lines to keep using AppiumClientConfig as appium python client for such a string case (to keep providing similar syntax to webdriver.Remote for selenium and appium)
There was a problem hiding this comment.
Pull Request Overview
This PR introduces the new AppiumClientConfig to centralize client configuration while deprecating legacy direct connection arguments, which is a breaking change. Key changes include:
- New file appium/webdriver/client_config.py defining the AppiumClientConfig.
- Updates in tests and migration documentation to use the new client_config parameter.
- Modifications in WebDriver initialization to integrate AppiumClientConfig for command executor creation.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| appium/webdriver/client_config.py | Introduces the new AppiumClientConfig class. |
| test/unit/webdriver/webdriver_test.py | Updates tests to use client_config instead of direct_connection. |
| README.md | Provides migration guide and updates examples for new config usage. |
| appium/webdriver/webdriver.py | Updates WebDriver and connection logic to integrate AppiumClientConfig. |
Comments suppressed due to low confidence (1)
appium/webdriver/client_config.py:28
- Consider rephrasing 'If enables' to 'If enabled' for grammatical correctness in the argument description.
direct_connection: If enables [directConnect](https://github.com/appium/python-client?tab=readme-ov-file#direct-connect-urls) feature.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| SERVER_URL_BASE = 'http://127.0.0.1:4723' | ||
| # before | ||
| driver = webdriver.Remote( | ||
| SERVER_URL_BASE, |
There was a problem hiding this comment.
I would still prefer to keep the url positional argument
I believe most of the clients have the remote client arguments defined as (url, options), so this change would require all of them to change the code, which is a major inconvenience.
There was a problem hiding this comment.
upd: I can observe the below code supports such feature, so we just need to mention that in documents
There was a problem hiding this comment.
Sounds good.
The ClinetConfig requires remote_server_addr https://github.com/SeleniumHQ/selenium/blob/dbf3daef5519b0a35a8408510854ec7766455c66/py/selenium/webdriver/remote/client_config.py#L80C9-L80C27 so current example is to reduce adding remote_server_addr to both, but actually current one will confuse users.
I'll add this.
appium/webdriver/webdriver.py
Outdated
|
|
||
|
|
||
| def _get_remote_connection_and_client_config( | ||
| command_executor: Union[str, AppiumConnection], client_config: Optional[AppiumClientConfig] |
There was a problem hiding this comment.
should the optional value be assigned to None by default?
There was a problem hiding this comment.
Either is fine. Just wanted to let the caller explicitly set both
README.md
Outdated
|
|
||
|
|
||
| ### Quick migration guide from v4 to v5 | ||
| - This change affecs only for a user who speficies `keep_alive`, `direct_connection` and `strict_ssl` arguments for `webdriver.Remote`: |
There was a problem hiding this comment.
This change affects only user who specify ...
README.md
Outdated
|
|
||
| ### Quick migration guide from v4 to v5 | ||
| - This change affecs only for a user who speficies `keep_alive`, `direct_connection` and `strict_ssl` arguments for `webdriver.Remote`: | ||
| - Please use `AppiumClientConfig` as `client_config` arguemnt as below: |
There was a problem hiding this comment.
as below -> similar to how it is specified below
README.md
Outdated
| client_config=client_config | ||
| ) | ||
| ``` | ||
| - Note that you can keep using `webdriver.Remote(url, options=options, client_config=client_config)` format as well. Then, the `remote_server_addr` in `AppiumClientConfig` will prior than the `url` specified via `webdriver.Remote` |
There was a problem hiding this comment.
Then, the ... -> In such case the remote_server_addr argument of AppiumClientConfig constructor would have priority over the url argument of webdriver.Remote constructor
appium/webdriver/webdriver.py
Outdated
| if client_config is None: | ||
| # Do not keep None to avoid warnings in Selenium | ||
| # which can prevent with ClientConfig instance usage. | ||
| client_config = AppiumClientConfig(remote_server_addr=command_executor) |
There was a problem hiding this comment.
would it be possible to do the same without reassigning method arguments?
BREAKING CHANGE: Some of WebDriver.Remote constructor arguments were moved to AppiumClientConfig:
https://github.com/SeleniumHQ/selenium/blob/trunk/py/selenium/webdriver/remote/client_config.py