Selenium: isDisplayed()

Last updated on:

In my current project I have to expand calendar and change the date in it, the problem depend on the things I have being doing before, calendar sometimes expanded sometimes not. So I'm using isDisplayed() method to validate if calendar displayed or no on the page, and if it is not I click on the expand button.

if(!driver.getElment(By.id("some_id_here")).isDisplayed()){
                    driver.getElment(By.id("another_id_here")).click();
                } else {
                    System.out.println("The Element was expanded");
                }
View Comments

Leave a Comment

Use markdown or basic HTML and be nice.