栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

无法执行rsDriver(连接被拒绝)

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

无法执行rsDriver(连接被拒绝)

尝试运行不建议使用的

checkForServer()
Selenium时,有两种选择:

  • 使用rsDriver
  • 使用Docker

看到:

RSelenium::checkForServer()# Error: checkForServer is now defunct. Users in future can find the function in # file.path(find.package("RSelenium"), "examples/serverUtils"). The# recommended way to run a selenium server is via Docker. Alternatively# see the RSelenium::rsDriver function.

大家似乎 对发生问题rsDriver和码头工人是推荐的选项,所以我们走的这条路:

  • 安装码头工人
  • 运行它,按要求重新启动计算机
  • 通过在命令行中
    docker pull selenium/standalone-firefox
    (或
    chrome
    代替
    firefox
    )或在R中运行来拉取图像
    shell('docker pull selenium/standalone-firefox')
  • 通过在命令行中
    docker run -d -p 4445:4444 selenium/standalone-firefox
    或在R中运行来启动服务器
    shell('docker run -d -p 4445:4444 selenium/standalone-firefox')
  • 然后运行
    remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox'")
    。该文档对虚拟机提出了一些不同的建议,但我无法使其正常工作。

设置了这个,这是我的代码:

shell('docker run -d -p 4445:4444 selenium/standalone-firefox')remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox")remDr$open()remDr$navigate("http://www.google.com/ncr")remDr$getTitle()# [[1]]# [1] "Google"

有关更多信息的文档:

  • https://cran.r-project.org/web/packages/RSelenium/vignettes/RSelenium-basics.html
  • https://cran.r-project.org/web/packages/RSelenium/vignettes/RSelenium-docker.html


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/375989.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号