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. ResourceQuota与LimitRange区别

    ResourceQuota与LimitRange区别 ResourceQuota ResourceQuota 用来限制 namespace 中所有的 Pod 占用的总的资源 request 和 lim ...

  2. 【项目实战】从零到一搭建Spring Boot整合Mybatis-plus

    前言 2023年想搭建一套属于自己的框架,做一个属于自己想法的项目.这些年工作中一直用公司已有的框架,以前有跟着学习视频搭建过,但自己真正动手搭建时发现问题还是很多,比如没有引入Mybatis-plu ...

  3. Python自动批量修改文件名称的方法

      本文介绍基于Python语言,按照一定命名规则批量修改多个文件的文件名的方法.   已知现有一个文件夹,其中包括班级所有同学上交的作业文件,每人一份:所有作业文件命名格式统一,都是地信1701_姓 ...

  4. Selenium中的option用法实例

    Selenium中的option用法实例 在上一篇文章Selenium中免登录的实现方法一option中我们用到了option,而option的用法是很多的,本文举几个例子 关于无头浏览器,也属于op ...

  5. 洛谷p2669

    #include<bits/stdc++.h> using namespace std; int main() { int k,m=0,p=1;//p:给j个金币的第p天(1~j循环变化) ...

  6. .Net Framework创建grpc

    1.环境要求 .Net Framework 4.8 .Net Core 版本: https://www.cnblogs.com/dennisdong/p/17120990.html 2.Stub和Pr ...

  7. UBUNTU16.04卸载安装protobuf

    1.卸载 sudo apt-get remove libprotobuf-dev which protoc 然后删除路径即可 2.安装 sudo apt-get install autoconf au ...

  8. 跟着廖雪峰学python 005

    ​ 函数的调用.定义.参数 ​编辑 #######命名关键字参数没完 abs()函数:绝对值 >>> abs(100) 100 >>> abs(-20) 20 ma ...

  9. ClickHouse使用笔记

    什么是ClickHouse? ClickHouse是一个用于联机分析(OLAP)的列式数据库管理系统(DBMS). 更多说明请参考官网:https://clickhouse.com/docs/zh/ ...

  10. 安卓逆向 JNI实先java与C互通

    先来一张吊图 jdk_1.6.0_43/include/jni.h  这个头文件的地址 头文件分布 我们需要熟悉的 反射获取java中的类 1.jclass/类型 (JNICALL *FindClas ...