参考链接:https://blog.csdn.net/qq_33291559/article/details/80028119
1、模拟页面滚动
last_height = 0
repeat {
remDr$executeScript("window.scrollTo(0,document.body.scrollHeight);", list(remDr$findElement("css","body")))
Sys.sleep(10)
new_height=remDr$executeScript("return document.body.scrollHeight", list(remDr$findElement("css","body")))
if(unlist(last_height) == unlist(new_height)) {break} else
{last_height = new_height}
}
常用键盘事件( Key Presses)的对照表
https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidelementidvalue
remDr$switchToWindow无法工作的解决办法
https://github.com/ropensci/RSelenium/issues/143
This issue is due to changes in the underlying API of the driver (geckodriver) which firefox uses.
geckodriver is gradually implementing adherence to the w3c webdriver spec. This has a lot of similarity to
the old JSONwireprotocol underlying selenium but diverges in places. Window handles is where such divergence occurs.
Unfortunately currently there is no obviouys indicator of the webdriver specification expected by the server. I will look to give the user the option to use W3C spec until a better option is available.
myswitch <- function (remDr, windowId)
{
qpath <- sprintf("%s/session/%s/window", remDr$serverURL,
remDr$sessionInfo[["id"]])
remDr$queryRD(qpath, "POST", qdata = list(handle = windowId))
}
myswitch(remDr, remDr$getWindowHandles()[[2]])