When using Selenium Java 8 with Appium to automate handheld tests, the xPath elements found using the Appium Desktop in Native App context dynamically change making it difficult to automate the test without having to go back the next day and change the xpath after finding its new location using appium desktop. Using the Webview and google inspect through chrome mirroring didn’t work out either. Is there any way we can get accessibility Ids so the app has stable locators for testing and not dynamic ones? I have attached an example pom of the main menu screen to show you what I mean. Those are the xpath locators from the appium desktop and they dynamically change.
@NaveenkumarG8697 Hi, on the Capture2.JPG screenshot I can see that you are trying to automate the web page in browser, not a native app. Is that true? If yes, you have to use the Chrome Debug Tools (see article: https://developer.chrome.com/docs/devtools/remote-debugging/). Then, the data-test-id elements should be visible in the Chrome Debug Tools, as data-test-id is a HTML attribute, and it cannot be seen while using the Appium Desktop tool. The Appium Desktop tool works only for native mobile applications, it cannot find the HTML elements and its attributes.
It is native app, some times opens like that thats a separate issue but once we kill the app it launches as native app .once in a while it opens as web app that screen shot was taken at that time. To add to it , we are seeing element ids when we inspect in Appium but it is not finding during test run.