The app I want to test is a hybrid app developed with AngularJS.

I'm trying to automate a scenario with Appium.

To open a page with elements to 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. Commented Mar 24, 2017 at 9:12
  • @Antony did you manage to resolve this problem? Commented Aug 22, 2017 at 19:39

2 Answers 2


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 and acknowledge you have read our privacy policy.