appium / appium-mac2-driver

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

xpath relative to element does not work #195

Open hellozyemlya opened 1 year ago

hellozyemlya commented 1 year ago

It seems like that relative xpath does not work:

        console.log("Trying Relative xpath")
        console.log(await element.findElements("xpath", `.//*[@identifier="Ident"]`))
        console.log("----")

results it in same requests to webdriver as browser.findElements("xpath",//*[@identifier="Ident"])

logs:

2023-02-21T19:19:20.248Z INFO webdriver: [POST] http://127.0.0.1:4723/session/37fc0294-0d9e-4950-a252-b1ad7bae6dca/elements
2023-02-21T19:19:20.249Z INFO webdriver: DATA { using: 'xpath', value: './/*[@identifier="Ident"]' }
2023-02-21T19:19:20.477Z INFO webdriver: RESULT [
  {
    'element-6066-11e4-a52e-4f735466cecf': '0D4E28E9-CF9F-4D71-A256-9DB398A3A361',
    ELEMENT: '0D4E28E9-CF9F-4D71-A256-9DB398A3A361'
  },
  {
    'element-6066-11e4-a52e-4f735466cecf': 'F480DFA1-4221-4154-9007-F0C11FBD5B1A',
    ELEMENT: 'F480DFA1-4221-4154-9007-F0C11FBD5B1A'
  }
]

If that is expected, is that possible to query child elements by identifier in other way?

hellozyemlya commented 1 year ago

Maybe I am using findElements in incorrect way, if I replace findElements to $$, then everything works fine...

mykola-mokhnach commented 1 year ago

The provided information is not enough to make any assumptions. Please provide the page source and full server logs for the above client API invocations.