• <tfoot id='gW9j2'></tfoot>
    • <bdo id='gW9j2'></bdo><ul id='gW9j2'></ul>

  • <i id='gW9j2'><tr id='gW9j2'><dt id='gW9j2'><q id='gW9j2'><span id='gW9j2'><b id='gW9j2'><form id='gW9j2'><ins id='gW9j2'></ins><ul id='gW9j2'></ul><sub id='gW9j2'></sub></form><legend id='gW9j2'></legend><bdo id='gW9j2'><pre id='gW9j2'><center id='gW9j2'></center></pre></bdo></b><th id='gW9j2'></th></span></q></dt></tr></i><div id='gW9j2'><tfoot id='gW9j2'></tfoot><dl id='gW9j2'><fieldset id='gW9j2'></fieldset></dl></div>
    <legend id='gW9j2'><style id='gW9j2'><dir id='gW9j2'><q id='gW9j2'></q></dir></style></legend>

    <small id='gW9j2'></small><noframes id='gW9j2'>

      1. OpenQA.Selenium.WebDriverException:未知错误:Chrome 无法启动:在 Linux

        时间:2023-09-14

              <tbody id='qyNb7'></tbody>

              <bdo id='qyNb7'></bdo><ul id='qyNb7'></ul>
                <tfoot id='qyNb7'></tfoot>
                <legend id='qyNb7'><style id='qyNb7'><dir id='qyNb7'><q id='qyNb7'></q></dir></style></legend>
                • <i id='qyNb7'><tr id='qyNb7'><dt id='qyNb7'><q id='qyNb7'><span id='qyNb7'><b id='qyNb7'><form id='qyNb7'><ins id='qyNb7'></ins><ul id='qyNb7'></ul><sub id='qyNb7'></sub></form><legend id='qyNb7'></legend><bdo id='qyNb7'><pre id='qyNb7'><center id='qyNb7'></center></pre></bdo></b><th id='qyNb7'></th></span></q></dt></tr></i><div id='qyNb7'><tfoot id='qyNb7'></tfoot><dl id='qyNb7'><fieldset id='qyNb7'></fieldset></dl></div>
                • <small id='qyNb7'></small><noframes id='qyNb7'>

                  本文介绍了OpenQA.Selenium.WebDriverException:未知错误:Chrome 无法启动:在 Linux 上通过 Selenium start 执行测试时异常退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我创建了一个使用 Selenium 的应用程序,使用 .NetCore 在 Linux 上使用它,实际上这是我的代码实现:

                  公开课程序{公共静态异步任务 Main(string[] args){//chrome的设置var chromeOpts = new ChromeOptions();chromeOpts.AddArgument("headless");chromeOpts.AddArgument("no-sandbox");//获取chrome驱动所在的汇编路径字符串 codeBase = Assembly.GetExecutingAssembly().CodeBase;UriBuilder uri = new UriBuilder(codeBase);字符串路径 = Uri.UnescapeDataString(uri.Path);路径 = Path.GetDirectoryName(路径);var driver = new ChromeDriver(path, chromeOpts, TimeSpan.FromSeconds(180));}}

                  如您所见,我使用 Chrome 作为驱动程序,我下载了它

                  似乎 Selenium 无法启动应用程序.查看我得到的异常:

                  <块引用>

                  找不到 Chrome 二进制文件

                  很遗憾,我在网上没有找到类似的东西,有人可以帮助我吗?

                  提前致谢.

                  更新

                  我刚刚在我的 linux 机器上重新安装了 Chrome,现在上面的错误消失了,但是现在还有另一个问题,事实上我得到了这个错误:

                  OpenQA.Selenium.WebDriverException:未知错误:Chrome 无法启动:异常退出(驱动程序信息:chromedriver=2.9.248304,platform=Linux 4.4.0-130-generic x86_64)在 OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(响应错误响应)在 OpenQA.Selenium.Remote.RemoteWebDriver.Execute(字符串 driverCommandToExecute,Dictionary`2 参数)在 OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)在 OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor,ICapabilities desiredCapabilities)在 OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService 服务,ChromeOptions 选项,TimeSpan 命令超时)在 OpenQA.Selenium.Chrome.ChromeDriver..ctor(String chromeDriverDirectory, ChromeOptions options, TimeSpan commandTimeout) 在 ODS.Program.Main(String[] args)

                  解决方案

                  这个错误信息...

                  OpenQA.Selenium.WebDriverException:未知错误:Chrome 启动失败:异常退出

                  ...暗示 ChromeDriver 无法启动/生成新的 WebBrowserChrome 浏览器 会话.

                  您的主要问题是您使用的二进制文件版本之间的不兼容性,如下所示:

                  • 您使用的是非常古老的 chromedriver=2.9.

                  所以 ChromeDriver 版本 (v2.33) 和最近的 Chrome 浏览器 版本 (vVersion68.0)

                  解决方案

                  • ChromeDriver 升级到当前的 ChromeDriverv2.41 级别.
                  • Chrome 版本保持在 Chrome v67-69 级别之间.(根据 ChromeDriver v2.41 发行说明)
                  • 清理你的项目工作区通过你的IDE重建你的项目只需要依赖.
                  • 如果您的基础 Web Client 版本太旧,请通过 卸载它Revo Uninstaller 并安装最新的 GA 和发布版本的 Web Client.
                  • 执行你的 @Test.
                  <小时>

                  参考文献

                  您可以在以下位置找到一些相关讨论:

                  • WebDriverException:消息:未知错误:Chrome 无法启动:在 debian 服务器上使用 ChromeDriver Chrome 和 Selenium 异常退出
                  • 消息:未知错误:Chrome 无法启动:在 AWS Cloud9 上使用 Linux 4.9.85-38.58.amzn1.x86_64 x86_64 异常退出
                  • WebDriverException:消息:未知错误:Chrome 无法启动:在 VPS 上通过 Python 使用 ChromeDriver Chrome 和 Selenium 异常退出

                  I created an application that use Selenium using .NetCore for use it on Linux, actually this is my code implementation:

                  public class Program 
                  {
                      public static async Task Main(string[] args)
                      {
                          //Settings for chrome
                          var chromeOpts = new ChromeOptions();
                          chromeOpts.AddArgument("headless");
                          chromeOpts.AddArgument("no-sandbox");
                  
                          //Get assembly path where chrome driver is located
                          string codeBase = Assembly.GetExecutingAssembly().CodeBase;
                          UriBuilder uri = new UriBuilder(codeBase);
                          string path = Uri.UnescapeDataString(uri.Path);
                          path = Path.GetDirectoryName(path);
                  
                          var driver = new ChromeDriver(path, chromeOpts, TimeSpan.FromSeconds(180));
                      }
                  }
                  

                  as you can see I am using as driver Chrome, I downloaded it here, I also added the driver inside the folder of the assembly, in this way the ChromeDriver knows already where to search it.

                  On linux I changed the folder permission using chmod -R 777, but when I run my Dotnet application I get this:

                  Seems that Selenium cannot start the application. Looking at the Exception I get:

                  Cannot find Chrome binary

                  Unfortunately I didn't find anything similar on the web, someone could help me?

                  Thanks in advance.

                  UPDATE

                  I Just reinstalled Chrome on my linux machine and now the error above went away, but there is another problem now, infact I get this error:

                  OpenQA.Selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally  (Driver info: chromedriver=2.9.248304,platform=Linux 4.4.0-130-generic x86_64)   
                    at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)   
                    at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)   
                    at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)   
                    at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)   
                    at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)   
                    at OpenQA.Selenium.Chrome.ChromeDriver..ctor(String chromeDriverDirectory, ChromeOptions options, TimeSpan commandTimeout)   at ODS.Program.Main(String[] args)
                  

                  解决方案

                  This error message...

                  OpenQA.Selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
                  

                  ...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.

                  Your main issue is the incompatibility between the version of the binaries you are using as follows:

                  • You are using chromedriver=2.9 which is pretty ancient.

                  So there is a clear mismatch between the ChromeDriver version (v2.33) and the recent Chrome Browser version (vVersion 68.0)

                  Solution

                  • Upgrade ChromeDriver to current ChromeDriver v2.41 level.
                  • Keep Chrome version between Chrome v67-69 levels. (as per ChromeDriver v2.41 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 through Revo Uninstaller and install a recent GA and released version of Web Client.
                  • Execute your @Test.

                  References

                  You can find a couple of relevant discussions in:

                  • WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally with ChromeDriver Chrome and Selenium on debian server
                  • Message: unknown error: Chrome failed to start: exited abnormally on AWS Cloud9 with Linux 4.9.85-38.58.amzn1.x86_64 x86_64
                  • WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally with ChromeDriver Chrome and Selenium through Python on VPS

                  这篇关于OpenQA.Selenium.WebDriverException:未知错误:Chrome 无法启动:在 Linux 上通过 Selenium start 执行测试时异常退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在 selenium c# ChromeDriver 中忽略 ssl_client_socket_impl.cc(1 下一篇:Selenium WebDriver C# 使用 ChromeDriver 和 FirefoxDriver 的完整网站截

                  相关文章

                      <bdo id='9zgIQ'></bdo><ul id='9zgIQ'></ul>

                  1. <i id='9zgIQ'><tr id='9zgIQ'><dt id='9zgIQ'><q id='9zgIQ'><span id='9zgIQ'><b id='9zgIQ'><form id='9zgIQ'><ins id='9zgIQ'></ins><ul id='9zgIQ'></ul><sub id='9zgIQ'></sub></form><legend id='9zgIQ'></legend><bdo id='9zgIQ'><pre id='9zgIQ'><center id='9zgIQ'></center></pre></bdo></b><th id='9zgIQ'></th></span></q></dt></tr></i><div id='9zgIQ'><tfoot id='9zgIQ'></tfoot><dl id='9zgIQ'><fieldset id='9zgIQ'></fieldset></dl></div>
                    1. <legend id='9zgIQ'><style id='9zgIQ'><dir id='9zgIQ'><q id='9zgIQ'></q></dir></style></legend>

                      <tfoot id='9zgIQ'></tfoot>
                    2. <small id='9zgIQ'></small><noframes id='9zgIQ'>