Chrome Automation Extension崩溃了 [英] Chrome Automation Extension has crashed
问题描述
我正在C#中使用Selenium来针对Google Chrome进行自动化.我正在使用最新版本的Chrome (78.0.3904.70)
,Selenium.Webdriver (3.141.0)
和Selenium.Chrome.Webdriver (77.0.0)
.
I am using Selenium in C# to automate against Google Chrome. I am using the latest version of Chrome (78.0.3904.70)
, Selenium.Webdriver (3.141.0)
, and Selenium.Chrome.Webdriver (77.0.0)
.
我使用:ChromeDriver chrome = new ChromeDriver();
. Chrome将打开,但无法正确加载,如下图所示,并且我无法使用任何Selenium功能.使用Chromedriver我需要更改什么?
I use: ChromeDriver chrome = new ChromeDriver();
. Chrome opens, but does not load correctly, like in the image below, and I am unable to use any Selenium features. What do I need to change to use Chromedriver?
我下载了ChromeDriver v.78
,并用new ChromeDriver(v78 path)
引用了它,并且它具有相同的错误.
I downloaded ChromeDriver v.78
and have referenced it with new ChromeDriver(v78 path)
, and it has the same error.
推荐答案
此错误消息...
连同此错误消息...
along with this error message...
...当ChromeDriver/Chrome无法加载默认扩展名时会观察到.
...is observed when ChromeDriver / Chrome is unable to load the default extensions.
从历史上看, Chrome浏览器的自动化扩展问题早于 ChromeDriver v2.32 浮出水面,您可以找到一个详细的版本中的讨论对于自动扩展加载,Chromedriver 2.32上发生了什么变化?
Historically, the Automation Extension issue with Chrome Browser surfaced a couple of builds earlier then ChromeDriver v2.32 and you can find a detailed discussion in What has changed on Chromedriver 2.32 regarding loading of the automation extension?
准确地说,要解决此错误,您可能必须:
Precisely, to address this error you may have to:
- 传递两个标志中的一个或两个:
-
disable-extensions
标志 -
--no-sandbox
标志
- Pass either/both of the flags:
disable-extensions
flag--no-sandbox
flag
作为参数>会话.启用沙盒时,特殊的测试环境有时会导致 Chrome 崩溃.有关详细信息,请观看此空间,如下所示:
as argument/s when creating your WebDriver session. Special test environments sometimes cause Chrome to crash when the sandbox is enabled. For detaile watch this space as follows:
var option = new ChromeOptions(); option.AddArgument("disable-extensions"); option.AddArgument("--no-sandbox"); driver = new ChromeDriver(option);
此外,您需要确保(以适用者为准):
Additionally, you need to ensure that (whichever is applicable):
- JDK 已升级到当前级别 JDK 8u222 .
- 硒已升级到当前级别版本3.141.59 .
- ChromeDriver 已更新为当前的 ChromeDriver v78.0 级别.
- Chrome 已更新为当前的 Chrome版本78.0 级别. (根据 ChromeDriver v78.0发行说明) 通过 IDE
- 清理您的项目工作区和重建您的项目,并且仅具有必需的依赖项.
- 如果您的基本 Web客户端版本太旧,则将其卸载并安装最新版本的 Web客户端 GA.
- 进行系统重启.
- 以非root用户/非管理员用户的身份执行
@Test
. - 始终在
tearDown(){}
方法中调用driver.quit()
以关闭&优雅地销毁 WebDriver 和 Web Client 实例.
- JDK is upgraded to current levels JDK 8u222.
- Selenium is upgraded to current levels Version 3.141.59.
- ChromeDriver is updated to current ChromeDriver v78.0 level.
- Chrome is updated to current Chrome Version 78.0 level. (as per ChromeDriver v78.0 release notes)
- Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
- If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
- Take a System Reboot.
- Execute your
@Test
as non-root / non-administrator user. - Always invoke
driver.quit()
withintearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.
这篇关于Chrome Automation Extension崩溃了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
-