-
Notifications
You must be signed in to change notification settings - Fork 570
feat: define AppiumClientConfig #1070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
27cb0ca
initial implementation
KazuCocoa 7823cd7
remove
KazuCocoa ce1f243
add appium/webdriver/client_config.py
KazuCocoa d31812d
Merge branch 'master' into use-client-config
KazuCocoa c658460
Merge branch 'master' into use-client-config
KazuCocoa 09e0c59
remove duplicated args
KazuCocoa dd19cff
remove duplicated args
KazuCocoa 3c1c02f
fix typo
KazuCocoa 0fbbb8e
Merge branch 'master' into use-client-config
KazuCocoa 69f086e
Merge branch 'master' into use-client-config
KazuCocoa bf0c96a
Merge branch 'master' into use-client-config
KazuCocoa 2aabd72
add file_detector and remove redundant config
KazuCocoa 9569035
add test to check remote_server_addr priority
KazuCocoa 2bdbea8
remove PLR0913, address http://127.0.0.1:4723
KazuCocoa b7fdaa4
update the readme
KazuCocoa d52e243
add comment
KazuCocoa b06ed8e
fix typo
KazuCocoa 671aa78
Merge branch 'master' into use-client-config
KazuCocoa 64a6553
extract
KazuCocoa 2b19e2e
extract and followed the selenium
KazuCocoa 9262c78
Merge branch 'use-client-config' of github.com:appium/python-client i…
KazuCocoa f56de0d
add comment
KazuCocoa 2a33f0d
Merge branch 'master' into use-client-config
KazuCocoa 299f283
Update webdriver.py
KazuCocoa 5bf6cc6
Apply suggestions from code review
KazuCocoa 72b2e42
update readme
KazuCocoa 8139b41
remove redundant command_executor check
KazuCocoa 7fc6113
Merge branch 'use-client-config' of github.com:appium/python-client i…
KazuCocoa 25b5af0
modify a bit
KazuCocoa b727e1f
fix typo and apply comment
KazuCocoa f27054f
use new variable
KazuCocoa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from selenium.webdriver.remote.client_config import ClientConfig | ||
|
||
|
||
class AppiumClientConfig(ClientConfig): | ||
"""ClientConfig class for Appium Python client. | ||
This class inherits selenium.webdriver.remote.client_config.ClientConfig. | ||
""" | ||
|
||
def __init__(self, remote_server_addr: str, *args, **kwargs): | ||
""" | ||
Please refer to selenium.webdriver.remote.client_config.ClientConfig documentation | ||
about available arguments. Only 'direct_connection' below is AppiumClientConfig | ||
specific argument. | ||
|
||
Args: | ||
direct_connection: If enables [directConnect](https://github.com/appium/python-client?tab=readme-ov-file#direct-connect-urls) | ||
feature. | ||
""" | ||
self._direct_connection = kwargs.pop('direct_connection', False) | ||
super().__init__(remote_server_addr, *args, **kwargs) | ||
|
||
@property | ||
def direct_connection(self) -> bool: | ||
"""Return if [directConnect](https://github.com/appium/python-client?tab=readme-ov-file#direct-connect-urls) | ||
is enabled.""" | ||
return self._direct_connection |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would still prefer to keep the
url
positional argumentI 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 addingremote_server_addr
to both, but actually current one will confuse users.I'll add this.