Javascript 如何获得图像';的工具提示,仅当我们将鼠标悬停在其上时才会显示。含硒

Javascript 如何获得图像';的工具提示,仅当我们将鼠标悬停在其上时才会显示。含硒,javascript,java,selenium,selenium-webdriver,selenium-chromedriver,Javascript,Java,Selenium,Selenium Webdriver,Selenium Chromedriver,我正在学习Selenium,我想得到Selenium控制台上打印的图像的工具提示,…工具提示只会在我们将鼠标移到图像上时出现。。我尝试获取xpath并使用actions。。但是它不起作用 the website I am using is...(https://mayexam.cpsatexam.org/certifications/) the tooltip of the three round logo images is i am looking for 字符串xpat

我正在学习Selenium,我想得到Selenium控制台上打印的图像的工具提示,…工具提示只会在我们将鼠标移到图像上时出现。。我尝试获取xpath并使用actions。。但是它不起作用

         the website I am using is...(https://mayexam.cpsatexam.org/certifications/) the tooltip of the three round logo images is i am looking for
字符串xpathTooltip1=“//*[@id=“tippy-1”]/div/div[2]”


工具提示通常是标题属性的一部分。在这种情况下,工具提示位于类为“tippy content”的“div”标记中

此代码将起作用

String img2 = "//*[@id=\"eael-section-tooltip-bf4f6d6\"]/div/div/img";
String xpathTooltip1 = "//div[@class='tippy-content']";


WebElement image= driver.findElement(By.xpath(img2));
Actions action = new Actions(driver);
action.moveToElement(image).perform();
String actTooltip = driver.findElement(By.xpath(xpathTooltip1)).getText();
System.out.println("The tooltip  is " + actTooltip);

工具提示通常是标题属性的一部分。在这种情况下,工具提示位于类为“tippy content”的“div”标记中

此代码将起作用

String img2 = "//*[@id=\"eael-section-tooltip-bf4f6d6\"]/div/div/img";
String xpathTooltip1 = "//div[@class='tippy-content']";


WebElement image= driver.findElement(By.xpath(img2));
Actions action = new Actions(driver);
action.moveToElement(image).perform();
String actTooltip = driver.findElement(By.xpath(xpathTooltip1)).getText();
System.out.println("The tooltip  is " + actTooltip);

网站
https://mayexam.cpsatexam.org/certifications/
是否可访问它是否作为
img
标记中的
title
属性存在?否它不是。。。我试过。。。Thanks@DebanjanB很抱歉,他们更改了url…我现在无法访问网站
https://mayexam.cpsatexam.org/certifications/
是否可访问它是否作为
img
标记中的
title
属性存在?否它不是。。。我试过。。。Thanks@DebanjanB很抱歉,他们更改了url…我现在无法访问它