Selenium: get content of SPAN html element

Trabla: Selenium: get content ( inner html ) of SPAN html element

Solving:


Use  getAttribute("innerHTML")

Example:

....

String xpath = "/html/body/div[16]/div/div[2]/div[2]/div[2]/section/div[2]/div[5]/span";


String result = driver.findElement(By.xpath(xpath)).getAttribute("innerHTML");

System.out.println(result);

...

No comments:

Post a Comment