appium / appium-mac2-driver

Next-gen Appium macOS driver, backed by Apple XCTest
Apache License 2.0
115 stars 24 forks source link

AttributeError: type object 'AppiumBy' has no attribute 'accessibilityId' #188

Closed arielelkin closed 1 year ago

arielelkin commented 1 year ago

I'm trying to locate an element using AppiumBy.accessibilityId("identifier") (as documented here):

@pytest.fixture()
def driver():
    options = Mac2Options()
    options.bundle_id = 'com.example.myapp'
    drv = webdriver.Remote('http://127.0.0.1:4723', options=options)
    yield drv
    drv.quit()

def test_edit_text(driver):
    edit_field = driver.find_element(by=AppiumBy.accessibilityId("mytextfield"))

This fails with the following error: AttributeError: type object 'AppiumBy' has no attribute 'accessibilityId'

mykola-mokhnach commented 1 year ago

The documentation contains pseudocode as Appium supports clients in multiple languages. Consider checking the documentation for the python client itself to find appropriate alternatives

arielelkin commented 1 year ago

OK I understand now. But it's not clear from the documentation that the examples are pseudocode.

I think it'd be useful if those examples were in the most commonly used Appium client languages (JS or Python), alternatively the documentation should explicitly indicate that the examples are pseudocode.

mykola-mokhnach commented 1 year ago

Thanks for suggestions. You are welcome to create a PR and improve these docs. The team would only be happy about such contributions.