0

I'm trying to scroll in table on the page. I had read this answer. But it didn't works for me. This is page were table presented. How can i select it with webdriver and scroll to the bottom of it? Content in table is loadable. I need this to count how many items is in the table now. Maybe exists some other hint to make it easier?

bad_coder
  • 11,289
  • 20
  • 44
  • 72
cat-ninja
  • 39
  • 12

1 Answers1

1

You can scroll using JavaScript:

JavascriptExecutor jsExec = (JavascriptExecutor) driver;
jsExec.executeScript("document.querySelector('#gwt-debug-contentPanel > div:nth-child(2) > div > div:nth-child(2) > div > div:nth-child(3) > div > div > div > table > tbody > tr:nth-child(1) > td:nth-child(1) > div.GNHGC04CJJ').scrollTop = 500");

But to find out the number there's an easier way:

WebElement number = driver.findElement(By.cssSelector("#gwt-debug-contentPanel > div:nth-child(2) > div > div:nth-child(2) > div > div:nth-child(3) > div > div > div > table > tbody > tr:nth-child(1) > td:nth-child(1) > div.gwt-HTML"));
String range = number.getText();

Then parse the higher number to an integer.

Moshisho
  • 2,781
  • 1
  • 23
  • 39