【发布时间】:2020-08-07 21:42:35
【问题描述】:
我正在学习 Selenium,我想在 selenium 控制台上打印图像的工具提示,...只有当我们将鼠标悬停在图像上时才会出现工具提示。我试图获取 xpath 并使用了操作。 .但它不起作用..
the website I am using is...(https://mayexam.cpsatexam.org/certifications/) the tooltip of the three round logo images is i am looking for
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);
【问题讨论】:
-
无法访问网站
https://mayexam.cpsatexam.org/certifications/ -
你的
img标签中没有title属性吗? -
不,不是...我试过...谢谢
-
@DebanjanB 很抱歉,他们更改了网址...我现在无法访问它
标签: javascript java selenium selenium-webdriver selenium-chromedriver