I am trying to enter the text in a textbox, but I am getting an error as follows

org.openqa.selenium.InvalidElementStateException: Element must not be hidden, disabled or read-only

Anybody can help me regarding this issue to be fixed.

  • Does the page by chance have a loading modal? – Paul Muir Dec 3 '15 at 2:16
  • No, it doesn't. The steps are like this 1. Login 2. MouseOver 3. Select Frame 4. Enter text, but here i am unable to enter the text – Bunny Dec 4 '15 at 7:50
  • Did you check it - stackoverflow.com/questions/11858366/… Might be your issue same as this. – Sachin Feb 14 '16 at 13:13

You may try with javascriptexecutor- Check below code-

// select the editor nad do the input 

WebElement TextBox = driver.findElement(By.id("tinymce"));
String input= "editor done";
JavascriptExecutor jst= (JavascriptExecutor) driver;
jst.executeScript("arguments[1].value = arguments[0]; ", input, TextBox);   

// switch back to the default window 
  • 1
    Your answer would be more helpful if you explained how this would fix the OP's problem. – Kate Paulk Apr 14 '16 at 11:23
  • @kate Paulk - Sometimes some browsers like Internet Explorer sendKey is not working to enter text in the text box. In this situation we will use javaScriptexecutor which is the best solution for sendKeys. I think you are well known about how to use javaScript. – Bharat Mane Dec 9 '16 at 12:53

Include what you are using to select the IWebelement on the page in the question above.

  1. Try opening the html page with the textbox in chrome
  2. Hamburger menu > More tools > Developer tools,
  3. Right click on the textbox > Inspect element.
  4. Right click > Copy css text/Copy XPath text.
  5. Then compare the result with what your using to select the element.

Is the xpath/css the same? Change it to what you copied. Does it work now? If you are selecting by id? Does that match? Change it to the id in the highlighted text, does it work now?


@Bunny - Give a try to below solution :

textBox.sendKeys("Bunny, Pls Enter your text in text box");

Hope it will help ! Come up if you have queries.


Here is the snippet of the code for WebDriver.


// select the editor nad do the input 

 driver.findElement(By.id("tinymce")).sendKeys("editor done");

// switch back to the default window 


Is the element you are selecting the actual element which receives the text? Without being able to see the html you are working on, you may be sending the text to a container for the actual input element.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.