我有一个应用程序,我需要将鼠标悬停在菜单项上,然后我需要点击Link.I能够悬停但不能点击下面的链接,即使它存在,selenium也能够识别它。
我尝试过以下代码: -
Actions action = new Actions(driver);
Thread.sleep(10000);
action.moveToElement(hover_element).moveToElement(Element_To_Click).click().build().perform();
action.moveToElement(hover_element).build().perform();
Thread.sleep(3000); driver.findElement(by2).click();
答案 0 :(得分:1)
试试这个并查看它是否有效:
Actions action=new Actions(driver);
action.moveToElement(hover_element);
Thread.sleep(5000);
action.perform();
action.moveToElement(Element_To_Click).click().perform();