如何使用selenium webdriver选择弹出型按钮的子菜单
我想使用SeleniumWebDriver选择弹出按钮的子菜单。 另外,如何使用selenium在菜单项上模拟悬停 请指导或提供一些相同的教程 谢谢检查课程,您需要这样的东西:如何使用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
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);