Sitelet https://github.com/appium/python-client/commit/7c741e68a05dad0ee4a2d7adf932aee2a00b0fa7
Skip to content

Commit 7c741e6

Browse files
ci(deps-dev): bump ruff from 0.15.22 to 0.16.0 (#1261)
* ci(deps-dev): bump ruff from 0.15.22 to 0.16.0 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.22 to 0.16.0. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](astral-sh/ruff@0.15.22...0.16.0) --- updated-dependencies: - dependency-name: ruff dependency-version: 0.16.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * fix format --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kazuaki Matsuo <fly.49.89.over@gmail.com>
1 parent c7c1240 commit 7c741e6

2 files changed

Lines changed: 58 additions & 61 deletions

File tree

‎README.md‎

Lines changed: 37 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,19 @@ For example, some changes in the Selenium binding could break the Appium client.
7171
options=UiAutomator2Options().load_capabilities(desired_caps),
7272
direct_connection=True,
7373
keep_alive=False,
74-
strict_ssl=False
74+
strict_ssl=False,
7575
)
7676
7777
# after
7878
from appium.webdriver.client_config import AppiumClientConfig
79+
7980
client_config = AppiumClientConfig(
8081
remote_server_addr=SERVER_URL_BASE,
8182
direct_connection=True,
8283
keep_alive=False,
8384
ignore_certificates=True,
8485
)
85-
driver = webdriver.Remote(
86-
options=UiAutomator2Options().load_capabilities(desired_caps),
87-
client_config=client_config
88-
)
86+
driver = webdriver.Remote(options=UiAutomator2Options().load_capabilities(desired_caps), client_config=client_config)
8987
```
9088
- Note that you can keep using `webdriver.Remote(url, options=options, client_config=client_config)` format as well.
9189
In such case the `remote_server_addr` argument of `AppiumClientConfig` constructor would have priority over the `url` argument of `webdriver.Remote` constructor.
@@ -138,7 +136,7 @@ from selenium.webdriver.common.actions.pointer_input import PointerInput
138136
139137
actions = ActionChains(driver)
140138
# override as 'touch' pointer action
141-
actions.w3c_actions = ActionBuilder(driver, mouse=PointerInput(interaction.POINTER_TOUCH, "touch"))
139+
actions.w3c_actions = ActionBuilder(driver, mouse=PointerInput(interaction.POINTER_TOUCH, 'touch'))
142140
actions.w3c_actions.pointer_action.move_to_location(start_x, start_y)
143141
actions.w3c_actions.pointer_action.pointer_down()
144142
actions.w3c_actions.pointer_action.pause(2)
@@ -173,6 +171,7 @@ environment:
173171
import pytest
174172
175173
from appium import webdriver
174+
176175
# Options are only available since client version 2.3.0
177176
# If you use an older client then switch to desired_capabilities
178177
# instead: https://github.com/appium/python-client/pull/720
@@ -200,7 +199,7 @@ def appium_service():
200199
service.stop()
201200
202201
203-
def create_ios_driver(custom_opts = None):
202+
def create_ios_driver(custom_opts=None):
204203
options = XCUITestOptions()
205204
options.platformVersion = '13.4'
206205
options.udid = '123456789ABC'
@@ -210,7 +209,7 @@ def create_ios_driver(custom_opts = None):
210209
return webdriver.Remote(f'http://{APPIUM_HOST}:{APPIUM_PORT}', options=options)
211210
212211
213-
def create_android_driver(custom_opts = None):
212+
def create_android_driver(custom_opts=None):
214213
options = UiAutomator2Options()
215214
options.platformVersion = '10'
216215
options.udid = '123456789ABC'
@@ -249,20 +248,20 @@ def android_driver():
249248
def test_ios_click(appium_service, ios_driver_factory):
250249
# Usage of the context manager ensures the driver session is closed properly
251250
# after the test completes. Otherwise, make sure to call `driver.quit()` on teardown.
252-
with ios_driver_factory({
253-
'appium:app': '/path/to/app/UICatalog.app.zip'
254-
}) as driver:
251+
with ios_driver_factory({'appium:app': '/path/to/app/UICatalog.app.zip'}) as driver:
255252
el = driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value='item')
256253
el.click()
257254
258255
259256
def test_android_click(appium_service, android_driver_factory):
260257
# Usage of the context manager ensures the driver session is closed properly
261258
# after the test completes. Otherwise, make sure to call `driver.quit()` on teardown.
262-
with android_driver_factory({
263-
'appium:app': '/path/to/app/test-app.apk',
264-
'appium:udid': '567890',
265-
}) as driver:
259+
with android_driver_factory(
260+
{
261+
'appium:app': '/path/to/app/test-app.apk',
262+
'appium:udid': '567890',
263+
}
264+
) as driver:
266265
el = driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value='item')
267266
el.click()
268267
```
@@ -300,6 +299,7 @@ Then python client will switch its endpoint to the one specified by the values o
300299
301300
```python
302301
from appium import webdriver
302+
303303
# Options are only available since client version 2.3.0
304304
# If you use an older client then switch to desired_capabilities
305305
# instead: https://github.com/appium/python-client/pull/720
@@ -308,22 +308,21 @@ from appium.webdriver.client_config import AppiumClientConfig
308308
309309
# load_capabilities API could be used to
310310
# load options mapping stored in a dictionary
311-
options = XCUITestOptions().load_capabilities({
312-
'platformVersion': '13.4',
313-
'deviceName': 'iPhone Simulator',
314-
'app': '/full/path/to/app/UICatalog.app.zip',
315-
})
316-
317-
client_config = AppiumClientConfig(
318-
remote_server_addr='http://127.0.0.1:4723',
319-
direct_connection=True
311+
options = XCUITestOptions().load_capabilities(
312+
{
313+
'platformVersion': '13.4',
314+
'deviceName': 'iPhone Simulator',
315+
'app': '/full/path/to/app/UICatalog.app.zip',
316+
}
320317
)
321318
319+
client_config = AppiumClientConfig(remote_server_addr='http://127.0.0.1:4723', direct_connection=True)
320+
322321
driver = webdriver.Remote(
323322
# Appium1 points to http://127.0.0.1:4723/wd/hub by default
324323
'http://127.0.0.1:4723',
325324
options=options,
326-
client_config=client_config
325+
client_config=client_config,
327326
)
328327
```
329328
@@ -333,6 +332,7 @@ driver = webdriver.Remote(
333332
334333
```python
335334
from appium import webdriver
335+
336336
# Options are only available since client version 2.3.0
337337
# If you use an older client then switch to desired_capabilities
338338
# instead: https://github.com/appium/python-client/pull/720
@@ -357,10 +357,7 @@ from appium import webdriver
357357
358358
from selenium.webdriver.remote.client_config import ClientConfig
359359
360-
client_config = ClientConfig(
361-
remote_server_addr='http://127.0.0.1:4723',
362-
ignore_certificates=True
363-
)
360+
client_config = ClientConfig(remote_server_addr='http://127.0.0.1:4723', ignore_certificates=True)
364361
driver = webdriver.Remote(client_config.remote_server_addr, options=options, client_config=client_config)
365362
```
366363
@@ -378,12 +375,9 @@ import urllib3
378375
from appium.webdriver.appium_connection import AppiumConnection
379376
380377
# Retry connection error up to 3 times.
381-
init_args_for_pool_manage = {
382-
'retries': urllib3.util.retry.Retry(total=3, connect=3, read=False)
383-
}
378+
init_args_for_pool_manage = {'retries': urllib3.util.retry.Retry(total=3, connect=3, read=False)}
384379
appium_executor = AppiumConnection(
385-
remote_server_addr='http://127.0.0.1:4723',
386-
init_args_for_pool_manage=init_args_for_pool_manage
380+
remote_server_addr='http://127.0.0.1:4723', init_args_for_pool_manage=init_args_for_pool_manage
387381
)
388382
389383
options = XCUITestOptions()
@@ -402,19 +396,22 @@ from appium.options.ios import XCUITestOptions
402396
403397
from appium.webdriver.appium_connection import AppiumConnection
404398
399+
405400
class CustomAppiumConnection(AppiumConnection):
406401
# Can add your own methods for the custom class
407402
pass
408403
404+
409405
custom_executor = CustomAppiumConnection(remote_server_addr='http://127.0.0.1:4723')
410406
411-
options = XCUITestOptions().load_capabilities({
412-
'platformVersion': '13.4',
413-
'deviceName': 'iPhone Simulator',
414-
'app': '/full/path/to/app/UICatalog.app.zip',
415-
})
407+
options = XCUITestOptions().load_capabilities(
408+
{
409+
'platformVersion': '13.4',
410+
'deviceName': 'iPhone Simulator',
411+
'app': '/full/path/to/app/UICatalog.app.zip',
412+
}
413+
)
416414
driver = webdriver.Remote(custom_executor, options=options)
417-
418415
```
419416
420417
The `AppiumConnection` can set `selenium.webdriver.remote.client_config.ClientConfig` as well.

‎uv.lock‎

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)