我可以遍歷菜單項,但最終的元素沒有被WebDriver點擊。Selenium Webdriver無法點擊子菜單項
我的代碼片段:
WebElement hover0 = driver.findElement(By.id("td_Menu_0"));
WebElement hover = driver.findElement(By.xpath(".//*[@id='role6_Maintain']/table/tbody/tr/td[1]"));
action.moveToElement(hover0).moveToElement(hover);
action.moveToElement(driver.findElement(By.cssSelector("#menuClickable_0_6_0_0")))
.click().build().perform();
最終WebElement
HTML:
<td onkeydown="return menuClickableOperation(this,event);"
onclick="javascript:deleteGrpWindowNode('menu_Maintain',0,'br_w_BusissPartner','BRGUI','Business Partner','','','HJHF');"
onmouseout="menuDeSelect(this);" onmouseover="menuSelect(this)"
onmousemove="DisplayIFrame();" tabindex="11" id="menuClickable_0_6_0_0"
class="menuNormal2">
<table width="100%">
<tbody>
<tr>
<td width="100%" style="">
<p title="Business Partner" class="MenuTxt">Business Partner</p>
</td>
</tr>
</tbody>
</table>
</td>
硒不拋出任何異常,但該元素不點擊,甚至沒有選擇 – 2014-11-22 07:51:08
哪一個是懸停在的菜單? **「hover0」或**「hover」** – Subh 2014-11-22 08:27:55
首先懸停在「hover0」上,使元素「懸停」可見,然後在鼠標懸停時「懸停」元素「menuClickable_0_6_0_0」變得可見 – 2014-11-22 08:35:30