How to interact with disabled TextBox using Selenium WebDriver?

Disabled TextBoxes

Sometimes the web pages may have the Textbox Fields which are disabled by default, which means that It won’t accept any keyboard interaction.

How to handle disabled Text Box Element using Selenium WebDiver?

  1. Element may allow typing values after clicking that element .So We can use first method and then use element.sendKeys().
  2. Enable that TextBox using Javascript and then use sendKeys().

When we try to interact with that element using Selenium WebDriver, then it throws

org.openqa.selenium.ElementNotInteractableException: element not interactable

Here is the JavaScript code to enable the element. Once it’s enabled, using sendKeys () we can type values in that selected textbox.

1 Like