- 问题: 请问如何利用Rselenium控制浏览器点击右键
并按t开启"在新分页开启连结"
[问题类型]:
程式咨询(我想用R 做某件事情,但是我不知道要怎么用R 写出来)
[问题叙述]:
想开启新分页或新视窗,在新分页或视窗进行爬虫动作。
以下code是参考stack overflow https://goo.gl/QZn9Q9
,没有出现error,只有执行按右键,但按t这个问题一直
未执行,请各位大大麻烦看一下,谢谢!
[程式范例]:
library(RSelenium)
dr <- remoteDriver(remoteServerAddr = "localhost", port = 4444, browserName =
"chrome")
dr$open()
dr$navigate("http://www.stackoverflow.com")
# find the Users tab
webElem <- dr$findElement("id", "nav-users")
dr$mouseMoveToLocation(webElement = webElem) # move to the required element
dr$click(2) # right mouse button click
webElem$sendKeysToElement(list(key = "shift", "t"))
[关键字]:
Crawler, RSelenium