0
<ul class="ui-treenode-children">
<li aria-selected="true" aria-checked="true" aria-expanded="true" id="frmScrForm:multiLevelTree:0_0" data-rowkey="0_0" class="ui-treenode ui-treenode-parent folder" role="treeitem">
    <span class="ui-treenode-content ui-tree-selectable" aria-expanded="false" aria-selected="false" aria-checked="false">
        <span class="ui-tree-toggler ui-icon ui-icon-triangle-1-s"></span>
        <div class="ui-chkbox ui-widget tree_node_folder_expand">
            <div class="ui-chkbox-box ui-widget ui-corner-all ui-state-default">
                <span class="ui-chkbox-icon ui-icon ui-icon-check"></span>
            </div>
        </div>
        <span class="ui-treenode-icon ui-icon tree_node_folder_collaps"></span>
        <span class="ui-treenode-label ui-corner-all">
            <span class="tree_node_folder_text" style="background-color: transparent;">Company</span>
        </span>
    </span>
    <ul class="ui-treenode-children" style="">
    </ul>
</li>
</ul>

我正在使用selenium(selenium IDE)测试一棵树,我想根据它旁边的文本(或值)点击复选框。

这是树中一个节点的 HTML 代码,如何使用 selenium 单击文本(公司)旁边的复选框?

4

1 回答 1

0

请尝试使用以下 xpath

selenium.click("xpath=//span[@class='ui-treenode-content ui-tree-selectable']
   [contains(text(),"Company")]/parent::span/span/div/div/span");
于 2013-11-30T05:25:11.910 回答