I want to select the submenu of the flyout using selenium webdriver. Also how can I simulate on hover on menu items using selenium.

Please guide or provide some tutorial for the same.

Thanks

有帮助吗?

解决方案

Check the actions class, something like this you need:

WebElement element = driver.findElement(By.Id("id"));
Actions builder = new Actions(driver); 
Actions hover = builder.moveToElement(element);
hover.build().perform();

其他提示

String New_select_Just_Landed = "//*[@id='nav1']/a"; 

    WebElement Ba = driver.findElement(By.xpath(New_select_Just_Landed));
    WebElement subBa = driver.findElement(By.xpath("//*[@id='nav1']/section/ul/li/a"));

    Actions action = new Actions(driver);
    action.moveToElement(Ba).perform();
    Thread.sleep(2000); System.out.println("Mouse hoover succeed");
    action.moveToElement(subBa).perform();
    subBa.click();
    System.out.println("Click Just Landed! succeed");
    Thread.sleep(5000L);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top