Connect with one of the following accounts


Please wait while we redirect...

Views: 2113   

isDisplayed() and isEnabled() Methods are used to check the visibility of the web elements. These web elements can be buttons, drop boxes, checkboxes, radio buttons, labels etc.

  1. isDisplayed(): Verifies whether this element displayed or not?

  2. isEnabled() : Is the element currently enabled or not ? this will generally return true for everything but for disabled input elements returns false.

package com.selenium.practise;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class Verification {
    public static void main(String[] args) {
        System.setProperty("", "E:\\Soft Wares\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        String Url = "";
        // Open the application in chrome browser

        String expectedTitle = "Google";
        String actualTitle = driver.getTitle();
        // verification 

        if (expectedTitle.equals(actualTitle)) {
            System.out.println("Title verification Successful");
        else {
            System.out.println("Verification Failed");
        // verify if the “Google Search” button is displayed and print the result

        boolean submitEnabled = driver.findElement("gb_70")).isEnabled();

        boolean submitDisplayed = driver.findElement("btnK")).isDisplayed();

        if (submitDisplayed==true && submitEnabled==true) {

            System.out.println("verification success for isDisplayed() && isEnabled() methods");


        // close the web browser

Output :
Title verification is Successful
Verification success for isDisplayed() && isEnabled() methods

On By

Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News