Zach
Zach

Reputation: 10129

Appium iOS automation using Java : get element using accessibility Id?

I am new to iOS automation using Appium. I can access elements and do automation using XPath like this

driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[2]/UIASecureTextField[3]")).click();

I would like to access elements using the accessibility label name given. When using the Appium inspector I can see that the accessibility name is displayed under the parameter Value . But How to access this value using Java code?

Thanks.

Upvotes: 0

Views: 8408

Answers (2)

Karthick
Karthick

Reputation: 21

getAttribute will return the all the information about the element, you just need to filter what you want, Following code will return the value of the element.

driver.findElement(By.name("Sign in")).getAttribute("value")

Upvotes: 0

Ru Cindrea
Ru Cindrea

Reputation: 733

You should be able to use the findElementByAccessibilityId(String using) method in Java. More info on it here:

http://appium.github.io/java-client/io/appium/java_client/FindsByAccessibilityId.html

Upvotes: 1

Related Questions