zoukankan      html  css  js  c++  java
  • Software_programming_automation_selenium

    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     }
  • 相关阅读:
    em与rem之间的区别以及移动设备中的rem适配方案
    关于两个DIV之间的空白字符
    Bootstrap基本模板
    js 裁剪
    记一次诡异的bug
    Node切换版本
    git 撤销
    使用 iframe + postMessage 实现跨域通信
    <el-input>标签限制输入小数点
    vue elementyUI table :点击一行时选中这一行对应的复选框
  • 原文地址:https://www.cnblogs.com/masterSoul/p/11451695.html
Copyright © 2011-2022 走看看