I'm trying to read text tooltip in angular7 application via selenium. But get text is returning blank and javascript executor is returning null.
Link to the image of the DOM for which I'm not able to find the xpath
But get text is returning blank and javascript executor is returning null.
This is returning blank
driver().get("https://vmware.github.io/clarity/documentation/v0.12/tooltips");
Wait(3000);
System.out.println(driver().findElement(By.xpath("(//span[@class='tooltip-content'])[2]")).getText());
This is returning null
System.out.println(driver().findElement(By.xpath("(//span[@class='tooltip-content'])[2]")).getAttribute("value"));
String theTextIWant = ((JavascriptExecutor) driver()).executeScript("return arguments[0].innerHTML;",driver().findElement(By.xpath("(//span[@class='tooltip-content'])[2]")));
To extract the tooltip text Lorem ipsum sit within the Angular7 Application using Selenium you have to:
You can use the following solution:
Code Block:
Console Output:
Browser Snapshot: