我正面临 chrome 中的错误,即 “您正在使用不受支持的命令行标志 – 忽略证书错误。稳定性和安全性将受到影响。” 对于我下面的 Selenium 代码。
Public Sub key()
Dim selenium As New SeleniumWrapper.WebDriver
selenium.Start "chrome", "https://google.com/"
selenium.stop
End Sub
我在下面的链接中搜索了相同的错误解决方案。
http://www.abodeqa.com/tag/how-to-remove-you-are-using-an-unsupported-command-line-flag-ignore-certificate-errors-stability-and-security-will-suffer/
请解释我如何将上面链接中提到的答案应用到我的 VBA 代码中。
最佳答案
我找不到 SeleniumWrapper 的文档。所以,我假设 SeleniumWrapper.WebDriver.Start
不处理任何与“ChromeOptions”相关的参数。
如果上述假设成立,则不能申请 the given solution in C# .
相反,您可以尝试以下操作:(我引用了 this )
Imports OpenQA.Selenium
Imports OpenQA.Selenium.Chrome
...
...
Public Sub key()
Dim service As OpenQA.Selenium.Chrome.ChromeDriverService = OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService()
Dim chromeOptions As New OpenQA.Selenium.Chrome.ChromeOptions()
chromeOptions.AddExcludedArgument("ignore-certifcate-errors")
chromeOptions.AddArgument("test-type")
Dim driver As IWebDriver = New ChromeDriver(service, chromeOptions)
driver.Navigate().GoToUrl("https://google.com/")
driver.Quit()
End Sub
我根据在 C# 中运行 Selenium 的经验添加了几行代码。
请提供哪里
SeleniumWrapper
及其文档以确定是否可以/不能设置 ChromeOptions
为 SeleniumWrapper
.
关于vba - 使用 Chromeoptions 在 Webdriver 中处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44923496/