0

After exhaustively searching for this over various forums, I still don't have an answer. Here are complete details

I'm identifying the element through classname which points to multiple(4) buttons. I'm iterating through buttons and then search for text and when there is a match i click it.

This works fine with selenium webdriver and browsers such as firefox,chrome

Now I'm doing the same thing with appium. Out of 4 buttons which are identified through classname, the script clicks 2 buttons successfully but for two buttons click happens(i can see the button being clicked) but new page which should be loaded is not loaded. The buttons for which click is not happening are in a footer class and other two are in div class.

Things i have already tried

  1. Actions builder - click(), clickandhold()
  2. Javascript executor

I'm currently trying with touch options, tap and by switching to native view but haven't found any success.

If any has encountered the same, a solution will be appreciated.

I want to avoid xPath because that might change in the page I'm working on, and I want to stress that the script is able to find the button, but is not able to click it properly.

jitinsharma
  • 1,436
  • 13
  • 22

3 Answers3

0

You can filter your locator by using class name and index. Like this:

driver.findElementsByXPath("//*[@class='android.widget.ImageView' and @index='0']");

This xpath won't get change on other devices too.

Gaurav
  • 1,332
  • 11
  • 22
0

Could you see: Unable to find an element in Browser of the Android emulator using Appium and C# ? In case of testing web apps in browser the elements should be located as usual elements on the web page ( not as some classes like android.widget.EditText and android.widget.Button).

Alex
  • 362
  • 1
  • 5
  • 14
  • Yes i have done the same thing. I'm finding the element by xpath,className etc. The problem is the button is clicked but the action which should happen after clicking does not happen. – jitinsharma Mar 11 '15 at 04:18
0

Upadting appium java client to 1.5.0 (from 1.3.0) solved the issue. Need to check why!

jitinsharma
  • 1,436
  • 13
  • 22