首页 > 解决方案 > Rselenium 和 Geckodriver-firefox 中的“警告:潜在的安全风险”错误

问题描述

我正在尝试使用 RSelenium 访问页面。我在 R 中编写了我的代码,它在 Chrome 和 IE 中运行良好。但是当我使用 geckodriver 时,firefox 会显示以下消息,并且我在 R 控制台中收到错误消息:

在此处输入图像描述

Selenium message:
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info:os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_40'
Driver info: driver.version: unknown

Error:   Summary: UnknownError
     Detail: An unknown server-side error occurred while processing the command.
     class: org.openqa.selenium.WebDriverException
     Further Details: run errorDetails method

我发现我应该更改 firefox 配置文件,但它是 python 代码,我需要 R:

FirefoxProfile profile = new FirefoxProfile();
profile.setAcceptUntrustedCertificates(true);

在R中应该是这样的

fprof <- makeFirefoxProfile(list(browser.download.dir = "D:/temp"))
remDr <- remoteDriver(extraCapabilities = fprof)

但我不知道我应该写什么。

请你帮帮我。或者,如果您知道我如何禁用此警告!

标签: rsecurityfirefoxgeckodriverrselenium

解决方案


Selenium 要求您将和设置为。此外,已弃用,因此您现在必须使用,如下所示:acceptInsecureCerts acceptUntrustedCertsTRUEremoteDriverrsDriver

remDr=rsDriver(browser=browserName,extraCapabilities=list(acceptInsecureCerts=TRUE,acceptUntrustedCerts=TRUE))

推荐阅读