'Appium Select Element by ID
I am trying to convert my SeeTest suite to Appium, but I'm having one large issue:
I can't select elements by their @id attribute. When I try to select by ID, it says "element not found". When I view the apk through uiautomateviewer, no element @ids are visible.
SeeTest requires an apk to be an "instrumented" in order to select by @id. Is there any equivalent of "instrumentation" for Appium?
Solution 1:[1]
A good rule of thumb is that if it does not appear in the Appium inspector, do no use it. What you could do is something along the lines of:
driver.findElement(By.xpath("//<UIElementType[contains(@<identifier>, '<identifier value>')]>");
Where identifier can be
name or content-desc
label
text
and a few more.
Hopefully this will help with your changes.
Solution 2:[2]
public void athenaclick(String element) {
WebElement webElement = driver.findElement(By.id(element));
webElement.click();
System.out.println("Click element: "+element);
}
In seetest when you instrument you get extra properties which might not be available when in appium eg: text colour as seetest is a paid tool and appium is a open source.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Maximilian Ast |
