1

Selenium webdriver 无法单击 jquery 树。

<td id="xmlExportForm:j_id216:j__id217:4::j_id218:handles" class="rich-tree-node-handleicon rich-tree-h-ic-line-node">
<div>
<a id="xmlExportForm:j_id216:j__id217:4::j_id218:handle" class="rich-tree-node-handle" onclick="var c = Tree.Item.findComponent(this); if (!c) return; c.fireExpansionEvent();;A4J.AJAX.Submit('xmlExportForm',event,{'similarityGroupingId':'xmlExportForm:j_id216:j__id217:4::j_id218','parameters':{'xmlExportForm:j_id216:j__id217:4::j_id218NodeExpanded':'true','xmlExportForm:j_id216:j__id217:4::j_id218AjaxExpanded':true} ,'actionUrl':'/admin/xmlExport.seam'} ); return false;" href="#">
<img id="xmlExportForm:j_id216:j__id217:4::j_id218:handle:img:collapsed" class="rich-tree-node-handleicon-collapsed" style=";border:0" src="/a4j/g/3_3_3.Finalorg.richfaces.renderkit.html.images.TreePlusImage/DATB/eAH7%21%21%21%2172fXGBgYACWpBbU_" alt=""/>
<img id="xmlExportForm:j_id216:j__id217:4::j_id218:handle:img:expanded" class="rich-tree-node-handleicon-expanded" style="display: none;;border:0" src="/a4j/g/3_3_3.Finalorg.richfaces.renderkit.html.images.TreeMinusImage/DATB/eAH7%21%21%21%2172fXGBgYACWpBbU_" alt=""/>
</a>
</div>
</td>

我试过了:

 WebElement a = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("xpath selector")));
 a.click();

我单击了 id = "xmlExportForm:j_id216:j__id217:4::j_id218:handle" 的元素,但这不起作用。如何通过 WebDriver 单击“onclick”?谢谢。

4

0 回答 0