Jenkins尝试在Ubuntu上使用Selenium运行Maven项目时出现WebDriverException。

时间:2018-12-04 12:29:50

标签: maven jenkins selenium-webdriver

我想在Jenkins的Ubuntu上使用Selenium运行Maven项目。 如果我从命令行运行Maven构建,则可以正常工作,但是当我启动Jenkins作业时,它将失败。 我的驱动程序配置很简单:

    case "chrome":
        System.setProperty("webdriver.crome.driver", "chromedriver");
        driver = new ChromeDriver();
        break;

    case "firefox":
        System.setProperty("webdriver.firefox.driver", "geckodriver");
        driver = new FirefoxDriver();
        break;

Chrom和Firefox驱动程序存在相同的问题:

Jenkins的Firefox Maven日志

    1543922077895 mozrunner::runner INFO Running command:"/usr/lib/firefox/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.54Eos7tHOta5"
    Error: no DISPLAY environment variable specified
    org.openqa.selenium.WebDriverException: 
    invalid argument: can't kill an exited process
    Build info: version: '3.141.5', revision: 'd54ebd709a', time: '2018-11-06T11:42:16'
    System info: host: 'gminkov-desktop', ip: '10.162.20.70', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-39-generic', java.version: '1.8.0_191'
    Driver info: driver.version: FirefoxDriver

Jenkins为Chrom编写的Maven日志

    Starting ChromeDriver 2.43.600233 (523efee95e3d68b8719b3a1c83051aa63aa6b10d) on port 25504
    Only local connections are allowed.
    org.openqa.selenium.WebDriverException: 
    unknown error: Chrome failed to start: exited abnormally
      (unknown error: DevToolsActivePort file doesn't exist)
      (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
      (Driver info: chromedriver=2.43.600233 (523efee95e3d68b8719b3a1c83051aa63aa6b10d),platform=Linux 4.15.0-39-generic x86_64) 
      (WARNING: The server did not provide any stacktrace information)

0 个答案:

没有答案