nilesh nilesh - 1 year ago 206
Android Question

Can we find element by ID in appium

following link mentions that we can find element by giving id... but i am unable to find it.

find by "name" (i.e., the text, label, or developer-generated ID a.k.a 'accessibilityIdentifier' of an element)

i tried following code:

WebElement el = driver.findElement("txtLogin"));

where txtLogin is id for login button

it gives following exception:

org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)

can please anyone explain what are all the ways there to find elements in appium

Answer Source

You can use element ID as following:-

package name : com.example.testap

Element ID : txtLogin

write the following code -

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download