工作在硒webdriver首先,我想鼠标需要悬停在图像中显示的选项卡。从年龄到解决时间。使用Java。如何鼠标悬停,然后需要点击选项卡 - Selenium2
if(existsElement("ext-pr-backlog-evolution")==true){
WebElement menuHoverLink = driver.findElement(By.id("ext-pr-backlog-evolution"));// Problem in this line
actions.moveToElement(menuHoverLink).perform();//
JavascriptExecutor executor = (JavascriptExecutor)driver;// This is exactly opening the page
executor.executeScript("arguments[0].click();", driver.findElement(By.id("ext-pr-backlog-evolution")));// This is exactly opening the page
Thread.sleep(6000);
}
else{
System.out.println("element not present -- so it entered the else loop");
}
下面是HTML标签
<a id="ext-pr-backlog-evolution" class=" ext-pr-backlog-evolution" name="ext-pr-backlog-evolution" href="https://10.4.16.159/extranet_prbacklogevolutiontendency/reports/type/default/">Overview & Evolution</a>
在图像高达问题报告(PR)试图点击概述和演进机理分析标签表明它正在当鼠标悬停门票选项卡,但概述和Evloution页面正在打开。确切地说,它是打开选项卡,但不是悬停和点击。
我试着用你的代码..问题在于它悬停**问题报告**上面出现**票证**选项卡,并打开**平均时间分配**选项卡。我不知道这是如何发生的。我在开始运行你的代码之前评论Javascript。 – Amirdha
有没有其他方法可以解决这个问题。使用JavaScript执行器,我可以正确地找到元素。但同时它需要鼠标悬停,然后它需要点击选项卡。请任何人帮助我dix – Amirdha
确切的鼠标悬停然后单击,您将不得不使用“actions.moveToElement(menuHoverLink).click()。perform();”。尝试** Amith **建议的。使用不同的定位器,如linktext。您还可以在点击功能中传递要点击的元素。 – Husam