Skip to content

Commit 2aabd72

Browse files
committed
add file_detector and remove redundant config
1 parent bf0c96a commit 2aabd72

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ For example, some changes in the Selenium binding could break the Appium client.
7676
# after
7777
from appium.webdriver.client_config import AppiumClientConfig
7878
client_config = AppiumClientConfig(
79-
remote_server_addr=SERVER_URL_BASE,
8079
direct_connection=True,
8180
keep_alive=False,
8281
ignore_certificates=True,

appium/webdriver/client_config.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,25 @@
1414

1515

1616
class AppiumClientConfig(ClientConfig):
17-
"""ClientConfig class for Appium Python client."""
17+
"""ClientConfig class for Appium Python client.
18+
This class inherits selenium.webdriver.remote.client_config.ClientConfig.
19+
"""
1820

1921
def __init__(self, remote_server_addr: str, *args, **kwargs):
2022
"""
21-
TODO: add description
23+
Please refer to selenium.webdriver.remote.client_config.ClientConfig documentation
24+
about available arguments. Only 'direct_connection' below is AppiumClientConfig
25+
specific argument.
26+
27+
Args:
28+
direct_connection: If enables [directConnect](https://github.com/appium/python-client?tab=readme-ov-file#direct-connect-urls)
29+
feature.
2230
"""
2331
self._direct_connection = kwargs.pop('direct_connection', False)
2432
super().__init__(remote_server_addr, *args, **kwargs)
2533

2634
@property
2735
def direct_connection(self) -> bool:
36+
"""Return if [directConnect](https://github.com/appium/python-client?tab=readme-ov-file#direct-connect-urls)
37+
is enabled."""
2838
return self._direct_connection

appium/webdriver/webdriver.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
)
2424
from selenium.webdriver.common.by import By
2525
from selenium.webdriver.remote.command import Command as RemoteCommand
26+
from selenium.webdriver.remote.file_detector import FileDetector
2627
from selenium.webdriver.remote.remote_connection import RemoteConnection
2728
from typing_extensions import Self
2829

@@ -204,18 +205,23 @@ class WebDriver(
204205
):
205206
def __init__( # noqa: PLR0913
206207
self,
207-
command_executor: Union[str, AppiumConnection] = 'http://127.0.0.1:4444',
208+
command_executor: Union[str, AppiumConnection] = 'http://127.0.0.1:4723',
208209
extensions: Optional[List['WebDriver']] = None,
210+
file_detector: Optional[FileDetector] = None,
209211
options: Union[AppiumOptions, List[AppiumOptions], None] = None,
210212
client_config: Optional[AppiumClientConfig] = None,
211213
):
212214
if isinstance(command_executor, str):
213215
if client_config is None:
214216
client_config = AppiumClientConfig(remote_server_addr=command_executor)
217+
else:
218+
client_config.remote_server_addr = command_executor
219+
# To prevent generating RemoteConnection in selenium
215220
command_executor = AppiumConnection(client_config=client_config)
216221

217222
super().__init__(
218223
command_executor=command_executor,
224+
file_detector=file_detector,
219225
options=options,
220226
locator_converter=AppiumLocatorConverter(),
221227
web_element_cls=MobileWebElement,

0 commit comments

Comments
 (0)