Prashant
Prashant

Reputation: 1469

How to click on element in android using appium when DOM is not loading?

I am automating a native android application using appium and java. I could find locators of each element. Please refer below screen shots for your reference. Its not working as expected and getting me time out exception i.e. failed to find element where you can see, I have given correct id. For time being, I am using touchaction with x,y co-ordinates which is not correct solution. please help me to solve it.

Code snippet:

enter image description here

For example :

enter image description here

Exception Screen shot:

enter image description here

Upvotes: 0

Views: 1151

Answers (1)

Dmitri T
Dmitri T

Reputation: 168147

Try invoking driver.getPageSource() method and double check that the desired element is present in the XML page representation.

Going forward you can set printPageSourceOnFindFailure to true so Appium would print the source code of the page to the STDOUT on element find failure like:

caps.setCapability("printPageSourceOnFindFailure", true);

More information:

Upvotes: 0

Related Questions