Self Html Code with Selenium Htmlunit
How to get html code for WebElement using HtmlUnitDriver in Java?
System.out.println((String)((JavascriptExecutor)driver).executeScript("return arguments[0].innerHTML;", element));
Returns all the html code within this element, not the element itself. Also, if node is a self-closing tag like input
or img
, it returns an empty string. Finally, element.getAttribute("innerHTML")
doesn't work with HtmlUnitDriver
.
+3
source to share
No one has answered this question yet
Check out similar questions: