一尘不染

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

selenium

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

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

selenium代码:

   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

阅读 796

收藏
2020-06-26

共1个答案

一尘不染

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

您可以参考此链接http://chromedriver.chromium.org/downloads

2020-06-26