appium-mac2-driver icon indicating copy to clipboard operation
appium-mac2-driver copied to clipboard

xpath relative to element does not work

Open hellozyemlya opened this issue 2 years ago • 2 comments

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 avatar Feb 21 '23 19:02 hellozyemlya

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

hellozyemlya avatar Feb 21 '23 19:02 hellozyemlya

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.

mykola-mokhnach avatar Feb 21 '23 20:02 mykola-mokhnach