I am trying to loop through the handson table using the selenium web driver but cannot do it

There are 200 records in my handson table. but I can only see the first 27 records and only the first 8 columns of 25 columns.

Below is the type of code I've tried.

  • Code 1:

    WebElement invoice=driver.findElement(By.xpath("//*[@id='ht_aeb2df21163d7999']/div[1]/div[1]/div[1]/table/tbody/tr[1]/td[7]/a/i"));
    int y=invoice.getLocation().y; 
    int x=invoice.getLocation().x; 
    Actions act=new Actions(driver); 
    act.clickAndHold(invoice).dragAndDropBy(invoice,x,y).build().perform();
    invoice.click();
    
          

  • Code 2:

    Actions action=new Actions(driver);
    action.sendKeys(Keys.LEFT).perform();
    action.sendKeys(Keys.LEFT).perform();
    action.sendKeys(Keys.LEFT).perform();
    
          

  • Code 3:

    JavascriptExecutor js = (JavascriptExecutor)driver;
    js.executeScript("scroll(0, 750)");
    
          

+3


source to share


1 answer


I would try the javascript method, but set the actual element to scroll. The function scroll

is for a window.

For example, I can loop through the example here by doing



document.querySelectorAll('.wtHolder')[0].scrollTop = 500

      

using the developer tools console.

0


source







All Articles