简体   繁体   English

如何在Java中使用Selenium WebDriver测试工具提示是否有任何鼠标活动?

[英]How to test tooltip for any mouse activity with selenium webdriver in java?

I'm trying to test a tool tip option for mouseover activity on a web image element. 我正在尝试测试Web图像元素上鼠标悬停活动的工具提示选项。 How to make sure whether the tool tip is being displayed or not ? 如何确定是否显示工具提示? here the problem is, in Mozilla, multi-line tool tip will be displayed as single line only. 这里的问题是,在Mozilla中,多行工具提示将仅显示为单行。 Can anyone help me out on how to test these things ? 谁能帮助我测试这些东西?

Try this .. 尝试这个 ..

Actions builder = new Actions(driver);
WebElement Element1 = driver.findElement(By.xpath("//*[@id='badge_people']/li[1]/img"));
Thread.sleep(6000);
builder.moveToElement(Element1).perform();
System.out.println("User Name :"+ driver.findElement(By.xpath("//[@id='badge_people']/div/div[2]")).getText());
builder.moveToElement(Element1).release().perform();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM