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     }
  • 相关阅读:
    线段树(题集
    T3——拆分自然数
    P1309 瑞士轮
    普通母函数简单使用
    双向广度优先搜索
    秦九韶算法
    P1043-数字游戏
    网站在阿里云备案的详细全过程详细步骤
    从git拉取代码后经常出现maven窗口不见
    SpringBoot入门教程之打成war包在tomcat容器中执行
  • 原文地址:https://www.cnblogs.com/masterSoul/p/11451695.html
Copyright © 2011-2022 走看看