How to perform a mouse hover functionality using Selenium Webdriver?
Test Case is like say, open Yahoo site and there is link (Mail) beside Sign-In. Upon mouse hover it will show a tooltip.
When i try the below code, it is not mouse hovering the exact location, rather it hovers somewhere else. Where i am going wrong?
And also let me know, how to capture the Tooltip?
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
public class Sample
{
public static void main(String[] args)
{
WebDriver driver=new FirefoxDriver();
driver.get("http://www.yahoo.com");
driver.manage().window().maximize();
try
{
Thread.sleep(5000);
} catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
WebElement lMail=driver.findElement(By.xpath("//*[@title='Mail']"));
Actions builder=new Actions(driver);
builder.moveToElement(lMail).build().perform();
}
}