appium: Using @* in xpath is throwing a error message in 1.22.1 release

The problem

Using @* in xpath is throwing a error message in 1.22.1 release e.g: //[@=‘Hello’] //[contains(@,‘Hello’)] (//[contains(@,‘Hello’)])[last()]

Screenshot 2021-11-22 at 12 18 17 PM

Environment

  • Appium version (or git revision) that exhibits the issue: 1.22.1
  • Last Appium version that did not exhibit the issue (if applicable): 1.22
  • Desktop OS/version used to run Appium: NA
  • Node.js version (unless using Appium.app|exe): NA
  • Npm or Yarn package manager: NA
  • Mobile platform/version under test: Android 11 / ISO 15
  • Real device or emulator/simulator: Real device
  • Appium CLI or Appium.app|exe:

Details

If necessary, describe the problem you have been experiencing in more detail.

Link to Appium logs

Create a GIST which is a paste of your full Appium logs, and link them here. Do NOT paste your full Appium logs here, as it will make this issue very long and hard to read! If you are reporting a bug, always include Appium logs!

Code To Reproduce Issue [ Good To Have ]

Please remember that with sample code it’s easier to reproduce the bug and it’s much faster to fix it.

Please git clone https://github.com/appium/appium and from the sample-code directory, use one of your favourite languages and sample apps to reproduce the issue.

In case a similar scenario is missing in sample-code, please submit a PR with one of the sample apps provided.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (3 by maintainers)

Most upvoted comments

I did several experiments locally and it looks like the issue lies in the Eclipse’s xpath2 processor itself and is specific only to queries containing following or preceding axes. I’ve reported an issue to them. Lets see what the response would be. Maybe we’d need to have a temporary setting, which would allow to switch back to use xpath1 if we get no response from the Eclipse team soon.

I don’t think there is an easy way to ensure backward compatibility. Also, complex xpath locators are not being used very frequently as for my experience. We’d need to gather more feedback there to make particular conclusions.

This is a good example of why it’s beneficial to switch to Appium 2.0, so that you can choose to upgrade the android driver or not without it affecting upgrade paths for Appium or other drivers.