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     }
  • 相关阅读:
    Codeforces1499D The Number of Pairs
    Codeforces1493D GCD of an Array
    AtCoder Beginner Contest 192 F
    Codeforces 1485F Copy or Prefix Sum
    Miller_Rabin
    Codeforces Round 655 (Div. 2) E
    Codeforces Round 655 (Div. 2) D
    B
    A
    待更新笔记
  • 原文地址:https://www.cnblogs.com/masterSoul/p/11451695.html
Copyright © 2011-2022 走看看