Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XPath as a locator coming in recorded script #1342

Closed
2 tasks done
bawarim opened this issue Feb 12, 2024 · 4 comments
Closed
2 tasks done

XPath as a locator coming in recorded script #1342

bawarim opened this issue Feb 12, 2024 · 4 comments
Labels
not a bug Incorrect configuration or issue with app or Appium server/driver

Comments

@bawarim
Copy link

bawarim commented Feb 12, 2024

Is this an issue specifically with Appium Inspector?

  • I have verified that my issue does not occur with Appium, and should be investigated as an Appium Inspector issue

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When recording operation using appium inspector recorder then only XPath is coming as a locator strategy.
image

Expected Behavior

There should be an option of having different locator to be configured while recording. And same should be generated in recorded script.

Operating System

Windows

Appium Inspector Version

2023.12.2

Appium Version

No response

Further Information

No response

@bawarim bawarim added the bug Something isn't working label Feb 12, 2024
@eglitise
Copy link
Collaborator

This depends entirely on the suggested locators generated for your element. If the Inspector only generates XPath - that is what the Recorder will use. If the element has a unique ID and the Inspector suggests that, then the Recorder will pick that:
image

@eglitise eglitise added need info More information is needed from issue creator and removed bug Something isn't working labels Feb 12, 2024
@bawarim
Copy link
Author

bawarim commented Feb 12, 2024

The elements has unique IDs available, but still it uses the XPath.

image

image

Note: I am running it for hybrid application.

@eglitise
Copy link
Collaborator

Assuming this is an Android hybrid app, this makes sense, as the id locator strategy is not part of the W3C spec. Chrome runs in W3C mode by default, so it will only work with the available W3C strategies, of which the only one here is xpath.
However, you can disable Chrome's W3C mode, and the recorder will then be able to use other strategies. You can do this by starting the Inspector session with the "appium:chromeOptions": {"w3c": false} capability.
Check the UiAutomator2 web context capabilities for more info.

@bawarim
Copy link
Author

bawarim commented Feb 13, 2024

Thank you! "appium:chromeOptions": {"w3c": false} is working.

image

@eglitise eglitise added not a bug Incorrect configuration or issue with app or Appium server/driver and removed need info More information is needed from issue creator labels Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not a bug Incorrect configuration or issue with app or Appium server/driver
Projects
None yet
Development

No branches or pull requests

2 participants