Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can bounds(co-ordinates) be used while identifying an element on an Android App?

Can something like this work? Well, it's not working for me. Guys, what's the right-est way of making it work? Need Help (Appium version - 1.4.0.0 and Selenium 2.4.5)

dr.findElement(By.xpath("//android.widget.ImageButton[@bounds='[9,288][144,318]']"))
  .click();
like image 719
Abhinav Aradhya Avatar asked Jun 08 '15 12:06

Abhinav Aradhya


People also ask

How do I find my android element?

You can find the ID of an element using android uiautomatorviewer. just go to your SDK tools folder D:\Android\android-sdk\tools, here you can find uiautomatorviewer. Open it and take screen shots of your activity and find the id, class, package of any element. Highly active question.

How do you find the web element of a mobile app?

Use the UI Automator API, in particular the UiSelector class to locate elements. In Appium you send the Java code, as a string, to the server, which executes it in the application's environment, returning the element or elements.


1 Answers

Try below code, it works for me...

WebElement abc = driver.findElement(By.xpath ("//android.widget.ImageButton[@bounds='[9,288][144,318]']"))

abc.click();
like image 112
jammer Avatar answered Sep 30 '22 03:09

jammer