Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用selenium webdriver选择弹出型按钮的子菜单_Selenium_Selenium Webdriver_Ui Automation - Fatal编程技术网

如何使用selenium webdriver选择弹出型按钮的子菜单

如何使用selenium webdriver选择弹出型按钮的子菜单,selenium,selenium-webdriver,ui-automation,Selenium,Selenium Webdriver,Ui Automation,我想使用SeleniumWebDriver选择弹出按钮的子菜单。 另外,如何使用selenium在菜单项上模拟悬停 请指导或提供一些相同的教程 谢谢检查课程,您需要这样的东西: WebElement element = driver.findElement(By.Id("id")); Actions builder = new Actions(driver); Actions hover = builder.moveToElement(element); hover.build().perfo

我想使用SeleniumWebDriver选择弹出按钮的子菜单。 另外,如何使用selenium在菜单项上模拟悬停

请指导或提供一些相同的教程

谢谢

检查课程,您需要这样的东西:

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);