【问题标题】:RSelenium on rstudio Server; Firefoxrstudio 服务器上的 RSelenium;火狐
【发布时间】:2021-11-17 06:28:21
【问题描述】:

我想使用 RSelenium 进行网页抓取,但在尝试连接到 Firefox 时遇到了这个问题。将不胜感激。

 > rD <- rsDriver(browser = "firefox")
    checking Selenium Server versions:
    BEGIN: PREDOWNLOAD
    BEGIN: DOWNLOAD
    BEGIN: POSTDOWNLOAD
    checking chromedriver versions:
    BEGIN: PREDOWNLOAD
    BEGIN: DOWNLOAD
    BEGIN: POSTDOWNLOAD
    checking geckodriver versions:
    BEGIN: PREDOWNLOAD
    BEGIN: DOWNLOAD
    BEGIN: POSTDOWNLOAD
    checking phantomjs versions:
    BEGIN: PREDOWNLOAD
    BEGIN: DOWNLOAD
    BEGIN: POSTDOWNLOAD
    [1] "Connecting to remote server"
    
    Selenium message:Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line
    Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10'
    System info: host: 'L90801', ip: '10.146.202.24', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_162'
    Driver info: driver.version: unknown
    remote stacktrace: 
    
    Could not open firefox browser.
    Client error message:
         Summary: SessionNotCreatedException
         Detail: A new session could not be created.
         Further Details: run errorDetails method
    Check server log for further details.

【问题讨论】:

  • 你看过here吗?
  • 是的,问题是它是 python,我正在使用 R。我尝试在 RStudio 中使用路径,但没有任何效果。如果您能详细说明如何使用 RSelenium 将绝对路径传递给 Firefox,那就太好了。
  • 试过这种方法,没有结果exCap &lt;- list( "moz:firefoxOptions" = list( args = list('--headless'), binary = list('--C:\\\\Program Files\\\\Mozilla Firefox\\\\firefox.exe') ) ) # and use it here rD &lt;- rsDriver( browser = "firefox", extraCapabilities = exCap )@Dunois
  • 可能有很多原因,更新你的firefox浏览器,更新java,安装最新包,提到firefox的version,提到port。
  • 嗯,您是否按照推荐的here 使用Docker 和RSelenium?我认为rsDriver 方法根本不起作用。

标签: r selenium firefox rstudio rselenium


【解决方案1】:

这段代码对我来说很好,记住,你需要安装 java 并设置哪个是你的 chromeover

在错误消息中显示哪些可供您使用

rd <- rsDriver(port = 4445L,browser = "chrome", chromever = "95.0.4638.54")
rem <- rd$client
rem$open()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-25
    • 2023-03-16
    • 1970-01-01
    • 1970-01-01
    • 2021-06-07
    • 1970-01-01
    • 2018-04-15
    相关资源
    最近更新 更多