Skip to content

Instantly share code, notes, and snippets.

@angelovstanton
Created August 20, 2020 09:44
Show Gist options
  • Save angelovstanton/e7ad9fac1e30b6ee140e4bf2f7f222f3 to your computer and use it in GitHub Desktop.
Save angelovstanton/e7ad9fac1e30b6ee140e4bf2f7f222f3 to your computer and use it in GitHub Desktop.
@Test
public void getHtmlSourceOfWebElement() {
driver.navigate().to("http://automatetheplanet.com");
var element = wait.until(ExpectedConditions.visibilityOfElementLocated(
By.xpath("/html/body/div[1]/header/div/div[2]/div/div[2]/nav")));
String sourceHtml = element.getAttribute("innerHTML");
System.out.println(sourceHtml);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment