最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - RSelenium: Scroll down to load web content - Stack Overflow

programmeradmin0浏览0评论

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.

Then I repeat the process again.

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

The result is still the same.

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.

Then I repeat the process again.

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

The result is still the same.

Share Improve this question edited May 23, 2017 at 12:34 CommunityBot 11 silver badge asked Aug 7, 2016 at 18:36 Dunk ChawannutDunk Chawannut 1051 silver badge6 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 11

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

remDr$executeScript("window.scrollTo(0,document.body.scrollHeight);")
发布评论

评论列表(0)

  1. 暂无评论