Welcome to the Question and Answer site for Software Testing Professionals

You can get your queries resolved from Software Testing Professionals.

Ask a Question

Get answers and give answers to questions from other members.

View All Questions

Get votes and earn points to build your reputation in community.

View Hot Questions

How to check whether the text field is diababled

Solved 1 Answers 71 Views Programming
0 1
How do I check whether the text field is diabled after the check box is ticked, and is abled to insert values into it when the check box is unticked?

1 Answer

Best answer

First step is to find if Checkbox is ticked/checked. to do that you can use below line of code. 


Next step is to idenfity if text filed is disabled. to check that you can use below code. 


So your code should look like this.


 if(!driver.findElement(by).isEnabled()) System.out.println("Checkbox is checked, textbox is disabled.");



if(driver.findElement("Textbox locator here").isEnabled()) {

driver.findElement("Textbox locator here").sendKeys("I can enter keys");

System.out.println("Checkbox is checked, textbox is disabled.");




answered by
selected by

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

We have resolved 1.2k+ Software Testing queries!

Software Testing Board Weekly update

We will send you handpicked questions that you would love to answer.

View previous campaigns.

Top Contributors