【发布时间】: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 <- list( "moz:firefoxOptions" = list( args = list('--headless'), binary = list('--C:\\\\Program Files\\\\Mozilla Firefox\\\\firefox.exe') ) ) # and use it here rD <- rsDriver( browser = "firefox", extraCapabilities = exCap )@Dunois -
可能有很多原因,更新你的firefox浏览器,更新java,安装最新包,提到firefox的
version,提到port。 -
嗯,您是否按照推荐的here 使用
Docker和RSelenium?我认为rsDriver方法根本不起作用。
标签: r selenium firefox rstudio rselenium