无法在Linux平台上通过Jenkins中的Selenium启动Chrome浏览器 [英] Unable to launch Chrome browser through Selenium in Jenkins on Linux platform

查看:535
本文介绍了无法在Linux平台上通过Jenkins中的Selenium启动Chrome浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Jenkins正在显示启动chromedriver的消息,但未触发chromedriver并且测试用例失败.我不知道为什么会发生

Jenkins is showing message starting the chromedriver but the chromedriver is not triggered and testcase fails.i dont know why it is happening

注意:为此代码创建的xml在终端上成功运行.我认为问题出在chromedriver

Note: the xml created for this code runs successfully on terminal.i think issue is with chromedriver

硒代码:

   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

推荐答案

检查您的chromedriver版本和chromebrowser版本.当版本不匹配时,我已经注意到这种现象.

Check your chromedriver version and chromebrowser version. I had noticed this behaviour when there is a version mismatch.

您可以引用此链接 http://chromedriver.chromium.org/downloads

这篇关于无法在Linux平台上通过Jenkins中的Selenium启动Chrome浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆