Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用R连接Selenium服务器单机版_R_Python 2.7_Selenium Webdriver_Selenium Rc - Fatal编程技术网

使用R连接Selenium服务器单机版

使用R连接Selenium服务器单机版,r,python-2.7,selenium-webdriver,selenium-rc,R,Python 2.7,Selenium Webdriver,Selenium Rc,参考本网站的帖子,我可以创建一个webdriver。但是,我无法获得与Python相同的元素详细信息。我可以知道怎么做吗 我想刮掉每一轮的足球比赛桌 # using R library(RCurl) library(RJSONIO) library(XML) # running selenium system("java -jar selenium-server-standalone-2.35.0.jar") baseURL<-"http://localhost:4444/wd/hub/

参考本网站的帖子,我可以创建一个webdriver。但是,我无法获得与Python相同的元素详细信息。我可以知道怎么做吗

我想刮掉每一轮的足球比赛桌

# using R
library(RCurl)
library(RJSONIO)
library(XML)

# running selenium
system("java -jar selenium-server-standalone-2.35.0.jar")
baseURL<-"http://localhost:4444/wd/hub/"
server<-list(desiredCapabilities=list(browserName='firefox',javascriptEnabled=TRUE))

getURL(paste0(baseURL,"session"),
       customrequest="POST",
       httpheader=c('Content-Type'='application/json;charset=UTF-8'),
       postfields=toJSON(server))

serverDetails<-fromJSON(rawToChar(getURLContent('http://localhost:4444/wd/hub/sessions',binary=TRUE)))
serverId<-serverDetails$value[[1]]$id

# navigate to 7m.cn
URL = "http://data2.7m.cn/history_Matches_Data/2009-2010/92/en/index.shtml"
getURL(paste0(baseURL,"session/",serverId,"/url"),
       customrequest="POST",
       httpheader=c('Content-Type'='application/json;charset=UTF-8'),
       postfields=toJSON(list(url=URL)))
您可以使用该软件包(Selenium for R)。免责声明:我是开发者之一

require(relenium)

firefox <- firefoxClass$new()
firefox$get('http://data2.7m.cn/history_Matches_Data/2009-2010/92/en/index.shtml')
content <- firefox$getPageSource()
firefox$close()
require(释放)
火狐
require(relenium)

firefox <- firefoxClass$new()
firefox$get('http://data2.7m.cn/history_Matches_Data/2009-2010/92/en/index.shtml')
content <- firefox$getPageSource()
firefox$close()