简体   繁体   English

在Linux平台上无法通过Jenkins中的Selenium启动Chrome浏览器

[英]Unable to launch Chrome browser through Selenium in Jenkins on Linux platform

Jenkins is showing message starting the chromedriver but the chromedriver is not triggered and testcase fails.i dont know why it is happening Jenkins正在显示启动chromedriver的消息,但是chromedriver没有触发并且测试用例失败。我不知道为什么会发生

Note: the xml created for this code runs successfully on terminal.i think issue is with chromedriver 注意:为此代码创建的xml在终端上成功运行。我认为问题出在chromedriver

SELENIUM CODE: 硒代码:

   public class cmddd {
      @Test
      public void f() throws InterruptedException {
          System.setProperty("webdriver.chrome.driver", "/home/dev2/Downloads/newchromedriver/chromedriver");
            WebDriver m = new ChromeDriver();
            m.get("https://www.google.com/");
            System.out.println("passed");
    }
    }


JENKINS OUTPUT:

   Building in workspace /home/dev2/eclipse-workspace/seffcon
    [seffcon] $ /bin/sh -xe /tmp/jenkins170843147783066328.sh
    + ./cd.sh
    [TestNG] Running:
      /home/dev2/eclipse-workspace/seffcon/cd.xml

    Starting ChromeDriver 2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7) on port 20671
    Only local connections are allowed.

    ===============================================
    Suite
    Total tests run: 1, Failures: 1, Skips: 0
    ===============================================
    Build step 'Execute shell' marked build as failure
    Finished: FAILURE

This error message... 此错误消息...

Starting ChromeDriver 2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7) on port 20671
Only local connections are allowed.
.
Build step 'Execute shell' marked build as failure
Finished: FAILURE

...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser ie Chrome Browser session. ...暗示ChromeDriver无法启动/产生新的WebBrowser,Chrome浏览器会话。

Your main issue is the incompatibility between the version of the binaries you are using as follows: 您的主要问题是所使用的二进制版本之间的不兼容性 ,如下所示:

  • You are using chromedriver=2.40 您正在使用chromedriver = 2.40
  • Release Notes of chromedriver=2.40 clearly mentions the following : chromedriver = 2.40的发行说明中明确提到以下内容:

Supports Chrome v66-68 支持Chrome v66-68

  • Possibly you are using the latest Chrome Browser ie chrome=72.0 可能您使用的是最新的Chrome浏览器,即chrome = 72.0
  • As per ChromeDriver - WebDriver for Chrome : 按照ChromeDriver-适用于Chrome的WebDriver
    • If you are using Chrome version 73, please download ChromeDriver 73.0.3683.20 如果您使用的是Chrome 73版,请下载ChromeDriver 73.0.3683.20
    • If you are using Chrome version 72, please download ChromeDriver 2.46 or ChromeDriver 72.0.3626.69 如果您使用的是Chrome版本72,请下载ChromeDriver 2.46或ChromeDriver 72.0.3626.69
    • If you are using Chrome version 71, please download ChromeDriver 2.46 or ChromeDriver 71.0.3578.137 如果您使用的是Chrome版本71,请下载ChromeDriver 2.46或ChromeDriver 71.0.3578.137
    • For older version of Chrome, please see this discussion for the version of ChromeDriver that supports it. 对于旧版Chrome,请参阅此讨论以获取支持该版本的ChromeDriver。

Solution

  • Upgrade Chrome version to Chrome v72 level. Chrome版本升级到Chrome v72级别。
  • As per ChromeDriver - WebDriver for Chrome upgrade ChromeDriver to ChromeDriver v2.46 or ChromeDriver 72.0.3626.69 . 按照适用于Chrome的ChromeDriver-WebDriverChromeDriver升级到ChromeDriver v2.46ChromeDriver 72.0.3626.69
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only. 通过IDE 清理 项目工作区 ,并仅使用必需的依赖项重建项目。
  • 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 . 如果您的基本Web客户端版本太旧,请通过Revo Uninstaller卸载它,并安装最新的GA和Web Client的发行版本。
  • Take a System Reboot . 进行系统重启
  • Execute your @Test . 执行您的@Test
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully. 始终在tearDown(){}方法内调用driver.quit() ,以优雅地关闭和破坏WebDriverWeb Client实例。

Check your chromedriver version and chromebrowser version. 检查您的chromedriver版本和chromebrowser版本。 I had noticed this behaviour when there is a version mismatch. 当版本不匹配时,我已经注意到这种现象。

You can refer this link http://chromedriver.chromium.org/downloads 您可以参考此链接http://chromedriver.chromium.org/downloads

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Linux机器上通过jenkins运行selenium脚本时,firefox无法启动 - When running selenium script through jenkins on linux machine firefox is not getting launch 无法在Linux中的Jenkins上执行Chrome驱动程序 - Unable to execute the chrome driver on Jenkins in Linux 无法使用 Selenium Webdriver java 在 Linux 机器上运行 Headless Chrome 浏览器 - Unable to run Headless Chrome Browser on Linux Machine using Selenium Webdriver java Jenkins构建失败,浏览器无法在Linux上启动,但可以在本地计算机上运行 - Jenkins build fails & browser does not launch on linux but runs on local machine 无法启动在 Linux 盒上运行的 Jenkins 控制台 - Unable to launch the Jenkins console which is running on Linux box 如何在Linux中通过Selenium ChromeDriver和Python打开Chromium浏览器 - How to open Chromium Browser through Selenium ChromeDriver and Python in Linux 通过硒网格将节点平台配置为LINUX时,操作系统在硒网格中心控制台上显示为“未知” - OS appears as Unknown on Selenium Grid Hub console when Node Platform is configured as LINUX through selenium grid 未知错误:通过 Selenium 使用 ChromeDriver Chrome 在 Jenkins 上尝试 Maven 测试时找不到 Chrome 二进制文件 - unknown error: cannot find Chrome binary while attempting Maven test on Jenkins using ChromeDriver Chrome through Selenium 无法通过詹金斯打开Chrome浏览器-未知错误:Chrome无法启动:崩溃 - Not able to open the Chrome Browser through jenkins — unknown error: Chrome failed to start: crashed Jenkins与Linux机器一起使用硒脚本 - Jenkins with linux machine for selenium script
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM