10:52:37

Table 获取 tr list

注意会无法正常遍历获取。

修正后正常

 1     public SelectionCriteriaPage checkSpecifyTag(int count){
2 String gridXpath = "//div[@id='NewSelectionParentGridPlaceholder']//div[@id='gridPlaceHolder']//div[@class='dataTables_scrollBody']//table[@id='DataTables_Table_0']/tbody";
3 new WebDriverWait(driver,120).until(ExpectedConditions.presenceOfElementLocated(By.xpath(gridXpath)));
4 WebElement gridCandidate = driver.findElement(By.xpath(gridXpath));
5 List<WebElement> candidateList = gridCandidate.findElements(By.tagName("tr"));
6
7 int iteratorCount = Math.min(candidateList.size(),count);
8
9 for(int i = 0; i< iteratorCount; i++){
10 /* WebElement parent = candidateList.get(i);
11 WebElement mid = parent.findElements(By.tagName("td")).get(0);
12 WebElement current = mid.findElement(By.tagName("input"));*/
13
14 WebElement current = candidateList.get(i).findElements(By.tagName("td")).get(0).findElement(By.tagName("input"));
15
16 //WebElement current = candidateList.get(i).findElement(By.xpath("//td[1]/input"));
17 new WebDriverWait(driver,120).until(ExpectedConditions.elementToBeClickable(current));
18 JSExecutor.jsScrollIntoView(current);
19 current.click();
20 }
21 return this;
22 }

Software_programming_automation_selenium的更多相关文章

随机推荐

  1. P4711 「化学」相对分子质量 代码

    #include <bits/stdc++.h> using namespace std; double ret=0; namespace StringUtils { pair<st ...

  2. Mysql--回顾提要

    一.写在前 知识学了就忘!不用就忘!我太健忘!特此记录!用于复习打卡!Mysql干就完事了! 二.来辣! MyISAM表把自增主键最大id记录到文件,重启也不会丢.InnoDB记录到内存,重启数据库和 ...

  3. C#11新特性整理

    假期中有时间,整理了C#11的各个新特性,简单分享给大家. 一.使用VSCode新建一个.NET7.0的Console工程 <Project Sdk="Microsoft.NET.Sd ...

  4. 如何在 pyqt 中使用动画实现平滑滚动的 QScrollArea

    前言 在之前的博客<如何在 pyqt 中实现平滑滚动的 QScrollArea>中,我们使用定时器和队列实现了平滑滚动.但是实现代码还是有一点复杂,所以这篇博客将使用 Qt 的动画框架 Q ...

  5. Spring Security Form表单认证代码实例

    Spring Security Form表单认证 Spring Security中,常见的认证方式可以分为HTTP层面和表单层面,如下: HTTP基本认证 Form表单认证 HTTP摘要认证 Spri ...

  6. Vue14 条件渲染

    转:https://blog.csdn.net/weixin_57519185/article/details/121168426 1 简介 通过指令v-show和v-if可以实现条件渲染. 它们都能 ...

  7. mysql16 sql优化-order by-GROUP BY

    1.简要说明   在sql中常常用到order by,排序对于sql的查询速度有较大的的影响.mysql支持两种排序方式,FileSort和Index,Index效率高,它指MySQL扫描索引本身完成 ...

  8. JAVA虚拟机16-方法的动态调用

    更详细:https://www.cnblogs.com/jthr/p/15762527.html 1.子类重写父类方法 1.1父类 public class Father { public int n ...

  9. 转载:屎人-->诗人系列--码农之歌

    转贴经常关注的一个博主的文,感觉还挺有趣: https://goofegg.github.io/content.html?id=141 ************************** 这个系列第 ...

  10. Zstack私有云平台运行实践

    很高兴昨天加了大名鼎鼎的杰杰站长的微信,系统运行的怎么样,一定不能只是给力两个字完事,下面就上具体的: 经过这几年的运行费和预研经费的支持,组里除了在线的几台服务器外,慢慢离线也积攒了几台用作调试和做 ...