I am working on a test automation for an iOS app. I use the Appium-desktop-client (1.15.1) on MacOS (10.15) and find an element on Iphone 11 (13.3) via the Inspector with the following attributes: screenshot from the attributes
The goal is to do the following in java with appium (6.1.0) and selenium (3.13.0):
Find this element via the elementId and get the variable value (in this case 2,6 km).
The problem is reaching the element. In the Inspector, the accessibility-id and the name are always equal to the value, which means that I cannot localize the element with them.
The elementId is not fixed, it varies after the 3rd block of numbers (that means I can only use the 45000000-0000-0000.) I can also reproduce this elementId from the Inspector using the code from the "UID" attribute.
To localize the element I tried the following:
appiumDriver.findElementByXPath("//*[contains(@id,'45000000-0000-0000')]");
appiumDriver.findElementByXPath("//*[contains(@name,'45000000-0000-0000')]");
appiumDriver.findElementByXPath("//*[contains(@uid,'45000000-0000-0000')]");
appiumDriver.findElementByXPath("//*[contains(@elementId,'45000000-0000-0000')]");
appiumDriver.findElementByXPath("//*[contains(@RuntimeId,'45000000-0000-0000')]");
appiumDriver.findElementByXPath("//*[contains(@ProcessId,'45000000-0000-0000')]");
appiumDriver.findElementByXPath("//*[contains(@class,'45000000-0000-0000')]");
However, with all these attempts to locate the element came an org.openqa.selenium.NoSuchElementException.
My question now is, what do I have to write in the xpath to find the element via the part of the elementId from the Inspector (or the attribute UID) and then be able to read out the value.