package pack;
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 MouseOverDemo {
public static void main(String[] args) throws InterruptedException {
WebDriver driver = new FirefoxDriver();
driver.get("http://www.rightstart.com");
// Mouseover
on Health adn Safety
//
create new action builder instance by passing WebDriver instance to
// the
class
Actions builder = new Actions(driver);
//
WebElement and build it to generates a composite action containing
// all
actions so far, ready to be performed.
// a
is control tagname
WebElement a = driver
.findElement(By.id("navigation-top-cat-label-336"));
builder.moveToElement(a).build().perform();
Thread.sleep(2000);
// Mouseover
on sleep safety
builder = new Actions(driver);
a = driver.findElement(By.id("navigation-top-cat-label-1060"));
builder.moveToElement(a).build().perform();
Thread.sleep(2000);
// Mouseover
on baby monitors and click on baby monitors
builder = new Actions(driver);
a = driver.findElement(By.id("navigation-top-cat-label-1312"));
builder.moveToElement(a).click().build().perform();
}
}