5

I tried the code in here Scrolling page in RSelenium but it's not working as the web site that I'm working on will load more content as you scroll down. For example

webElem <- remDr$findElement("css", "body")
webElem$sendKeysToElement(list(key = "end"))
webElem$screenshot(display = TRUE)

This is the screenshot of part of the website. enter image description here

Then I repeat the process again.

webElem$sendKeysToElement(list(key = "end"))
webElem$screenshot(display = TRUE)

enter image description here

The result is still the same.

Community
  • 1
  • 1
Dunk Chawannut
  • 105
  • 1
  • 6

1 Answers1

11

If unfortunately your code does not work for scrolling down, try using executeScript() as below :-

remDr$executeScript("window.scrollTo(0,document.body.scrollHeight);")
Saurabh Gaur
  • 23,507
  • 10
  • 54
  • 73
  • As a side note for people still facing trouble: using the `args = list(...)` input of `$executeScript` might be a problem solver. – niko Apr 09 '18 at 14:48