【问题标题】:How to scroll page down until is fully loaded?如何向下滚动页面直到完全加载?
【发布时间】:2021-04-28 14:19:18
【问题描述】:

我想向下滚动直到页面满载新记录:

library(RSelenium)
rD <- RSelenium::rsDriver(browser = "firefox", check = FALSE)
remDr <- rD[["client"]]

remDr$navigate("https://investmentpolicy.unctad.org/international-investment-agreements")

remDr$findElement("link text", "Advanced Search")$clickElement()
remDr$findElement("id", "search-button")$clickElement()

【问题讨论】:

标签: r rselenium


【解决方案1】:

一个解决方案可能是

library(RSelenium)
rD <- RSelenium::rsDriver(browser = "firefox", check = FALSE)
remDr <- rD[["client"]]

remDr$navigate("https://investmentpolicy.unctad.org/international-investment-agreements")

#Find in the css enviroment the body   
scroll_d <- remDr$findElement(using = "css", value = "body")

#send to the browser to go to the end of the page. You could iterate it by a for loop
scroll_d$sendKeysToElement(list(key = "end"))

【讨论】:

    猜你喜欢
    • 2023-03-05
    • 1970-01-01
    • 1970-01-01
    • 2020-07-14
    • 1970-01-01
    • 2014-02-21
    • 2012-05-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多