I have a html document in memory as a string. It contains a tag with a little script that manipulates the dom. I now want to load that html page
Just a small update: escapeEcmaScrip() replaces escapeJavaScript() in 2015.
public static void main(String[] args) throws InterruptedException{
driver = new FirefoxDriver();
driver.get("http://dhtmlx.com/docs/products/dhtmlxTree/");
replaceHTML(By.xpath("//*/span[text()='Supported browsers:']"), "");
}
private static void replaceHTML(By by, String html) {
WebElement e = driver.findElement(by);
((JavascriptExecutor) driver).executeScript("arguments[0].innerHTML='" + StringEscapeUtils.escapeEcmaScript(html) + "'", e);
}