I was executing a selenium automation on IE11. Now for an Element, say ele; ele.sendKeys(characters)
are not working directly. So I was trying to change the \'value
You have to instantiate your WebElement
after manipulating the DOM, not before. Otherwise the stored WebElement
won't contain the information you are looking for and will return null
.
driver.executeScript("document.getElementById('ID').setAttribute('value','NEW_VALUE');");
System.out.print("value: "+driver.findElement(By.id("ID")).getAttribute("value"));