[enter image description here][1] I am not able to insert any data in tag. I always show Element is not reachable through Keyboard. It is possible through Javascript to insert. PLS help......XPath is not working. I am adding the to rectify. OR If this is not problem of then how to inert data in provided field.
答案 0 :(得分:1)
以下代码将解决您的问题
By preTagXpath = By.xpath("//pre");
JavascriptExecutor js = (JavascriptExecutor) driver;
String preValue = "This should be the new value";
js.executeScript("document.getElementsByTagName('pre')[0].innerText='" + preValue + "';");
System.out.println(driver.findElement(preTagXpath).getText());