[英]How to click CSS with a space using Selenium Webdriver
我正在嘗試點擊下面的CSS
html body.FormBackground form#LookupForm div#Panel1 table tbody tr td div#GridContainerDiv div table#DataGrid tbody tr.GridSelectedRow td.GridRow
到目前為止,我已經嘗試過
@FindBy(css = "#DataGrid\\tbody\\tr.GridSelectedRow > td.GridRow")
和
@FindBy(css = "#DataGrid tbody tr.GridSelectedRow > td.GridRow")
但是以上嘗試似乎都不起作用。 HTML在下面。
<tbody>
<tr ondblclick="$HRnet('DataGrid').dblClick(); " gender_id="f6611f8a-8e80-41e6-a14c-fa8e25be3065" class="GridUnSelectedRow">
<td class="GridRow">Female</td>
</tr>
<tr ondblclick="$HRnet('DataGrid').dblClick(); " gender_id="3ef09fb8-4d5d-43d2-abc0-2506616ef83e" class="GridSelectedRow">
<td class="GridRow">Male</td>
</tr>
<tr nofocus="true">
<td> </td>
</tr>
</tbody>
根據您共享的內容,它看起來應該可以工作,但是它將返回多行,因此您需要確定要單擊的行
@FindBy(css = "#DataGrid td.GridRow")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.