Currently, I am in the process of learning Selenium and aiming to retrieve the tooltip displayed on an image in the Selenium console. The tooltip is set to only appear when hovering over the image. Despite my attempts to obtain the xpath and use actions, I have encountered difficulties.
The website where this issue arises is https://mayexam.cpsatexam.org/certifications/. Specifically, I am interested in extracting the tooltips of the three circular logo images.
String xpathTooltip1 ="//*[@id="tippy-1"]/div/div[2]";
String img2 = "//*[@id=\"eael-section-tooltip-bf4f6d6\"]/div/div/img";
WebElement toolTIP = driver.findElement(By.xpath(img2));
action.clickAndHold(toolTIP).moveByOffset(50, 0);
String actTooltip = driver.findElement(By.xpath(xpathTooltip1)).getText();
System.out.println("The tooltip is " + actTooltip);