【发布时间】:2020-11-11 07:12:40
【问题描述】:
如果我重复这个问题,我深表歉意。我在这个网站上得到了很多答案,但我仍然没有得到工具提示文本。 如果我不使用 Actions 类悬停并显示工具提示,我可以阅读标题。 但是,一旦我使用 Actions 类来显示工具提示,那么标题始终为空。我不想在我之前得到文本 悬停,不就是阅读显示的工具提示文本的全部想法吗?
driver.get("https://jqueryui.com/tooltip/");
WebElement frame = driver.findElement(By.xpath("//iframe[@src='/resources/demos/tooltip/default.html']"));
driver.switchTo().frame(frame);
WebElement element = driver.findElement(By.id("age"));
Actions actions = new Actions(driver);
actions.moveToElement(element).perform(); (I've also tried clickAndHold method)
WebElement toolTip = driver.findElement(By.xpath("//*[@id='age']"));
// To get the tool tip text and assert
String toolTipText = toolTip.getAttribute("title");
System.out.println("toolTipText-->"+toolTipText);
【问题讨论】:
标签: java selenium-webdriver tooltip mouseover webdriverwait