How to check if element is disabled in Selenium Java


isEnabled() method in Selenium webdriver will verify and return true if the specified element is enabled. otherwise, it will return false.



boolean FirstName= driver.findElement(“fname”)).isEnabled();


Selenium Code :

Here Selenium Code to verify if the element is active or Deactive is given.

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;


public class Login {

public static void main(String[] args) {

// TODO Auto-generated method stub

System.setProperty(“”, “C:\\Software Program\\chromedriver.exe”);

WebDriver driver=new ChromeDriver();


//To verify that Element is Enabled or not

Boolean nn =driver.findElement(By.xpath(“//input[ @type=\”text\”]”)).isEnabled();

if(nn) {

System.out.println(“Element is Present”);


else {

System.out.println(” Element is not Present”);




How To Verify Element is Enabled or Disabled in Selenium
Verify Element is enabled or Disabled in Selenium

Also Read

How to enter Text in text box using Selenium 

By Admin

Welcome to Automation QA, your ultimate destination for comprehensive tutorials on automation across various domains. Whether you're a seasoned QA professional looking to enhance your skills or a newcomer eager to delve into the world of automation testing, our platform has something for everyone.

Leave a Reply

Your email address will not be published. Required fields are marked *