Search⌘ K
AI Features

Handling Read-Only, Disabled or Hidden Fields

Explore how to interact with read-only, disabled, and hidden text fields in Selenium WebDriver. Learn to use JavaScript execution to bypass default restrictions and verify field values effectively during automated testing.

Set a value to a read-only or disabled text field

Read only and disabled text fields are not editable and are shown differently in the browser. It is typically grayed out like:

An example of disabled and read-only text field on a web page
An example of disabled and read-only text field on a web page

The HTML codes for above example are as follows:

Read only text field:

 ...