Hi,
I am stuck in the situation where my browser xpath is working for browser and android device with x path.
I have used hybrid app to automate the test case with android. I am able to run the test case with x path on android device with same x path i used for browser.
Ex: I have used “//*[@id=‘dialog-btn’]” this xpath to find button in browser and Android app.
For android i am able to find this x path by switching the context to web-view.
But when same thing i tried with ios using appium it is not working.When tried to inspect element it is showing different x path in appium inspector.
For iOS elements, they might not having id attribute. you can choose xpath as //*[@name=‘xyz’] or AccessibilityId (if it is having name attribute, if not take absloute xpath).
Thanks for your reply.
But for me attribute is data-id not name.I have to create xpath using data-id attribute.I am trying t keep same xpath for all devices and browser
Yes it is working for android but not for ios.
With name it should be work that is fine but my requirement is use same xpath for all platforms.
//*[@id=‘dialog-btn’ is not working with appium because if we see pagesource ID attribute is not there.