Saturday, 23 January 2016

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



Reason : if object hidden, then webdriven unable to enter the text. so we need to enable the text by using javascriptexecutor, then will enter the script

Solution :

WebDriver driver = new FirefoxDriver();
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("document.getElementById('mini-7').setAttribute('type', 'text');");
driver.findElement(By.cssSelector("#mini-7 > input.mini-textbox-input")).clear();
driver.findElement(By.cssSelector("#mini-7 > input.mini-textbox-input")).sendKeys("yy");

1 comment:

  1. This article was exactly what I needed—thank you so much!The leaderboard is calling my name—gotta keep clicking! Join the challenge spacebar clicker

    ReplyDelete