Showing posts with label Actions Class. Show all posts
Showing posts with label Actions Class. Show all posts

Saturday, June 14, 2014

Use of Actions class

public class ClickCnChildMenu{
    public static void main(String[] args) {
        WebDriver driver=new FirefoxDriver();
        driver.get("http://new.mypomanager.com/Account/Login");
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
        driver.manage().window().maximize();
        driver.findElement(By.id("UserName")).sendKeys("retaileradmin");
        driver.findElement(By.id("Password")).sendKeys("password");
        driver.findElement(By.cssSelector("input[type='submit']")).click();
        WebElement parentmenu=driver.findElement(By.linkText("RETAILER"));
        Actions act=new Actions(driver);
        act.moveToElement(parentmenu).perform();
        WebElement createPO = driver.findElement(By.xpath("//a[contains(text(),'Create PO')]"));
        act.moveToElement(createPO).click().perform();
       
        }
}