testing - 如何使用 Selenium Webdriver 双击一个元素

标签 testing selenium selenium-webdriver

这是我们网站上的动态列表。

List Page

这是我要传递双击的 HTML 标记。

<td class="dxgv" align="left" style="color: rgb(51, 51, 51); font-size: 13px; border-bottom: 1px solid rgb(237, 237, 237); border-left-width: 0px; border-right-width: 0px; width: 5.6em; max-width: 6em; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;">Sun Kumar</td>

我想一直双击第一条记录,即使每次点击后第一条记录都会被删除

最佳答案

既然你想双击第一条记录,你可以试试这个java代码:

(假设网页中有一个表格,因为上面没有完整的HTML代码,内容的行从第2开始。)

Actions act = new Actions(driver);
act.doubleClick(driver.findElement(By.xpath("//table//tr[2]//td[@class='dxgv'][1]"))).build().perform();

 Actions act = new Actions(driver);
 act.moveToElement(driver.findElement(By.xpath("//table//tr[2]//td[@class='dxgv'][1]"))).doubleClick().build().perform();

关于testing - 如何使用 Selenium Webdriver 双击一个元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27054560/

相关文章:

javascript - 在 Selenium Python 中禁用图像

selenium - 如何在 Selenium 中获取 JavaScript 确认提示的内容?

html - 如何选择其中包含类名的 anchor

selenium-webdriver - 在 Selenium 和 IEx 中触发更改事件?

ruby-on-rails - 创建自定义 rspec 变量,如 Controller 规范的响应

python - 无法使用 selenium 线程关闭进程

java - selenium webdriver 如何获取在 iframe 所见即所得文本区域中输入的文本

testing - 无法弄清楚如何在构建测试中使用 "link"按钮

javascript - 如何通过匹配文本来选择下拉选项?

android - 为什么没有 BroadcastReceiver 的测试仪器?