【发布时间】:2016-10-31 00:06:48
【问题描述】:
我无法让我的 Selenium-Webdriver 脚本检查 Susie 的复选框。我尝试使用单击和发送空格键,并更改我的 xpaths。有人可以帮我找到一种方法来指定我需要 Susie 的复选框,并帮我点击它吗?
页面上的 HTML
<tr class="dataRow">
<td class="jtable-selecting-column">
<input type="checkbox">
</td>
<td class=" FirstName ">Laura</td>
<td class=" LastName ">Test</td>
<td class=" SMSNumber ">4444444444</td>
</tr>
<tr class="dataRow">
<td class="jtable-selecting-column">
<input type="checkbox">
</td>
<td class=" FirstName ">Susie</td>
<td class=" LastName ">Test</td>
<td class=" SMSNumber ">5555555555</td>
我的代码
WebDriverWait waitPlease = new WebDriverWait(webDriver, TimeSpan.FromSeconds(10));
IWebElement myDynamicElement = waitPlease.Until<IWebElement>(d => d.FindElement(By.ClassName(" FirstName ")));
clickButtonWithXPath("/html/body/div[3]/div[1]/div[2]/div[2]/div[2]/div[1]/div/table/tbody/tr[4 ]/td[1]/输入");
错误
读取“System.InvalidOperationException:未知错误:元素在点 (192,464) 处不可点击。其他元素将收到点击:...
【问题讨论】:
-
这些行得通吗?我需要添加多少代码?
-
好的,谢谢
-
我假设这是一种类型,没有结束标签。无论如何,您可以尝试按类名 =“jtable-selecting-column”单击 td 吗?
-
编辑:我添加了我一直在使用的代码,该代码具有显式等待,然后是复选框的 xpath。
标签: c# checkbox selenium-webdriver