Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ permissions:

jobs:
release:
# Releases are cut from the upstream repository only. Without this guard the
# workflow also runs on forks, where semantic-release rewrites the version in
# pyproject.toml, commits to the default branch and attempts a PyPI upload.
if: github.repository == 'appium/python-client'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
Expand Down
25 changes: 25 additions & 0 deletions test/unit/webdriver/webdriver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import pytest
import urllib3
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.common.by import By

from appium import webdriver
from appium.options.android import UiAutomator2Options
Expand Down Expand Up @@ -294,6 +295,30 @@ def test_get_events_catches_missing_events(self):
events = driver.events
assert events == {}

@httpretty.activate
@pytest.mark.parametrize('by', [By.ID, By.NAME, By.CLASS_NAME])
def test_find_element_keeps_locator_strategy(self, by):
# Selenium's default LocatorConverter rewrites these strategies to 'css selector',
# which Appium native contexts do not support.
driver = android_w3c_driver()
httpretty.register_uri(
httpretty.POST,
appium_command('/session/1234567890/element'),
body='{"value": {"element-6066-11e4-a52e-4f735466cecf": "element-id"}}',
)
httpretty.register_uri(
httpretty.POST,
appium_command('/session/1234567890/element/element-id/element'),
body='{"value": {"element-6066-11e4-a52e-4f735466cecf": "child-element-id"}}',
)
el = driver.find_element(by=by, value='foo')
d = get_httpretty_request_body(httpretty.last_request())
assert d == {'using': by, 'value': 'foo'}

el.find_element(by=by, value='bar')
d = get_httpretty_request_body(httpretty.last_request())
assert d == {'using': by, 'value': 'bar'}

@httpretty.activate
@patch('appium.webdriver.webdriver.logger.warning')
def test_session_catches_error(self, mock_warning):
Expand Down