【发布时间】:2018-01-13 22:57:23
【问题描述】:
几天前我问并回答了this question,并让 Rselenium 运行良好。
现在我无法导航了,我认为没有任何改变,所以我很困惑。
shell('docker run -d -p 4445:4444 selenium/standalone-chrome')
remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "chrome")
remDr$navigate("http://www.google.com") # used to work
# Error in checkError(res) :
# Undefined error in httr call. httr output: length(url) == 1 is not TRUE
我做了一些调试,remDr$navigate 调用了一个名为 queryRD 的方法,出现问题,请参见下面的代码
debugging in: queryRD(qpath, "POST", qdata = list(url = url))
debug: {
"A method to communicate with the remote server implementing the \\n JSON wire protocol."
getUC.params <- list(url = ipAddr, verb = method, body = qdata,
encode = "json")
res <- tryCatch({
do.call(httr::VERB, getUC.params) # VERB doesn't like the url argument its getting
}, error = function(e) {
e
})
if (inherits(res, "response")) {
resContent <- httr::content(res, simplifyVector = FALSE)
checkStatus(resContent)
}
else {
checkError(res)
}
}
ipAddr 在我的情况下是 char(0) 而不是有效的 url。而且VERB 不喜欢url 的论点,因此它得到了结果。
如何让它像以前一样运行?
要在正确的位置进行调试:
shell('docker run -d -p 4445:4444 selenium/standalone-chrome')
remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "chrome")
debugonce(remDr$navigate)
remDr$navigate("http://www.google.com")
debugonce(queryRD)
c
【问题讨论】:
标签: r selenium rselenium httpverbs