I am working in Appium and My app is a hybrid app it is coded with Angular js.

I have scenario to automate. A page opens like select date -> today, tomorrow and pick a date

<div class="item item-divider">
                <p>Select Date</p>
<button class="button button-block button-light">Today</button>

<button class="button button-block button-light">Tomorrow</button>

<button class="button button-block button-light">Pick a date</button>

Let's say I select the date as today. How to automate this scenario?

enter image description here

  • Hi @comrade can you please add a screenshot of the screen and some more HTML for finding out the element. Mar 24 '17 at 9:12
  • @Antony did you manage to resolve this problem? Aug 22 '17 at 19:39

You are getting this because of the classname used. Try the code below to get all textviews elements

List<WebElement> textViews = driver.findElements(By.Xpath("//*[conatains(@class,'button-block'));

for (WebElement textView : textViews)

    System.out.println( textView.getText());

Another alternative would be to find elements by class name and then iterate through the list. You may do something like this

boolean todaysDateFound = false;

List <WebElement> days = DRIVER.findElements(By.className("button button-block button-light"));

for (int i = 0; i < days.size(); i++) {
    if (days.get(i).getAttribute("name").equals("Today")) {
        todaysDateFound = true;

If you want to make this smarter and decide what to pick based on user input, then you can use a Select..Case statement as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy