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.
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It only takes a minute to sign up.
Sign up to join this communityI 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.
You may try with javascriptexecutor- Check below code-
driver.switchTo().frame("WallItemItemDetail_ifr");
// select the editor and do the input
WebElement TextBox = driver.findElement(By.id("tinymce"));
String input= "editor done";
TextBox.getAttribute("name");
JavascriptExecutor jst= (JavascriptExecutor) driver;
jst.executeScript("arguments[1].value = arguments[0]; ", input, TextBox);
// switch back to the default window
driver.switchTo().defaultContent();
Include what you are using to select the IWebelement on the page in the question above.
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 :
element_select_frame.sendKeys("");
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.
driver.switchTo().frame("WallItemItemDetail_ifr");
// select the editor and do the input
driver.findElement(By.id("tinymce")).sendKeys("editor done");
// switch back to the default window
driver.switchTo().defaultContent();
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.
This is the problem faced by automation engineers in many qa testing companies while entering data to adisabled webelement. This can be done by using java script.
Below is one way to set text This is the problem faced by automation engineers in many qa testing companies while entering data to an webelement disabled. This can be done by using java script.
Below is one way to set text 'testuser' to a webElement 'userNameTxt' :
//find the element in selenium webdriver WebElement userNameTxt = driver.findElement(By.Id("username"));
// set the text
JavascriptExecutor jsExecutor = (JavascriptExecutor) driver;
jsExecutor.executeScript("arguments[0].value='testuser'", userNameTxt);