我正在使GWT应用程序自动化。有一个包含以下列的表格:复选框,用户ID,用户名,Fname,LName,电子邮件。如何根据行值选择表格中的复选框?
下面是一个单行表中的代码:
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td class="GB1F3LJFQ GB1F3LJKO" title="8902" align="right" style="height: 19px; width: 34px;">
<div style="height: 19px; width: 34px;">
<div class="gwt-HTML">8902</div>
</div>
</td>
<td class="GB1F3LJFQ GB1F3LJKO" title="Agency_Group_0_Agency_Group_Member_0_dan_all_features_6" align="left" style="height: 19px; width: 146px;">
<div style="height: 19px; width: 146px;">
<div class="gwt-HTML">Agency_Group_0_Agency_Group_Member_0_dan_all_features_6</div>
</div>
</td>
<td class="GB1F3LJFQ GB1F3LJKO" title="" align="left" style="height: 19px; width: 63px;">
<div style="height: 19px; width: 63px;">
<div class="gwt-HTML">
</div>
</div>
</td>
<td class="GB1F3LJFQ GB1F3LJKO" title="" align="left" style="height: 19px; width: 28px;">
<div style="height: 19px; width: 28px;">
<div class="gwt-HTML">
</div>
</div>
</td>
<td class="GB1F3LJFQ GB1F3LJKO" title="[email protected]" align="left" style="height: 19px; width: 146px;">
<div style="height: 19px; width: 146px;">
<div class="gwt-HTML">[email protected]</div>
</div>
</td>
</tr>
</tbody>
</table>
中的XPath的复选框: /HTML /体/ DIV [ 6]/DIV /表/ tbody的/ TR [2]/TD [2]/DIV/DIV/DIV/DIV /表/ tbody的/ TR [2]/TD/DIV/DIV/DIV/DIV [1] /格/表[10]/tbody的/ TR/TD [ 1]
用户名列的xpath是: /html/body/div [6]/div/table/tbody/tr [2]/td [2]/div/div/div/div/table/tbody/tr [2]/td/div/div/div/div [1]/div/table [10]/tbody/tr/td [3]
我的代码循环遍历名称列表应该点击与该名称相关联的复选框: 作为成员列表中的姓名: 打印'与%s'关联的单击复选框%姓名 chrome.find_element_by_xpath(“// tr [td [contains(text()='”+ ()
我得到的错误是: sele nium.common.exceptions.InvalidSelectorException:消息:无效的选择器:由于以下错误,无法找到具有xpath表达式的元素// tr [td [contains(text()='Agency_Group_0_Agency_Group_Member_0_dan_all_features_6')]]/td [1] : SyntaxError:无法对'Document'执行'evaluate':字符串'// tr [td [contains(text()='Agency_Group_0_Agency_Group_Member_0_dan_all_features_6')]]/td [1]'不是有效的XPath表达式。 (会话信息:chrome = 48.0.2564.116)
我的问题是: 如何点击与名称关联的复选框?
也许有时你需要鼠标移到它,然后继续前进,点击它。你知道有时候物体不是直接启用的,直到鼠标在它上面为止。 – Srekk