Internet explorer 硒罐';t单击Internet Explorer中的隐藏菜单元素

Internet explorer 硒罐';t单击Internet Explorer中的隐藏菜单元素,internet-explorer,selenium-webdriver,Internet Explorer,Selenium Webdriver,我使用这样的代码: WebElement button = driver.findElement(By.xpath("main_menu")); Actions builder = new Actions(driver); Action action = builder.moveToElement(button).build(); action .perform(); new Actions(driver).moveToElement(driver.findElement(By.xpath(su

我使用这样的代码:

WebElement button = driver.findElement(By.xpath("main_menu"));
Actions builder = new Actions(driver);
Action action = builder.moveToElement(button).build();
action .perform();
new Actions(driver).moveToElement(driver.findElement(By.xpath(sub_menu))).click().perform(); 
我有最新版本的selenium,需要使用IE,我在FireFox中尝试了这段代码,它可以工作。 但在IE中,它并没有点击子菜单元素,而是点击主菜单下的一些空间(目前它是主菜单的第二项)


如何在IE中单击子菜单项

您能检查一下您在firefox中使用的相同xpath在IE中是否也能正常工作吗?

试试javascript:

driver.execute_script('arguments[0].click();', element)

如果元素是隐藏元素,则要单击。

如果手动使用IE,是否可以单击?IE上的渲染可能不同,阻止单击。是的,我可以手动单击。这可能是时间问题,请尝试使用selenium命令等待元素出现。我尝试了try waits,但没有帮助