简体   繁体   English

Selenium无法从Jenkins运行Firefox浏览器

[英]Selenium Not able to run Firefox browser from Jenkins

I tried running Automated test using selenium on firefox through jenkins on Ubuntu Machine but not able to run it. 我尝试通过Ubuntu计算机上的jenkins在firefox上使用硒运行自动测试,但无法运行它。 But the same code is running without failure using Eclipse. 但是,使用Eclipse可以运行相同的代码而不会失败。 I am running it as maven project. 我将其作为Maven项目运行。

Getting following error- 得到以下错误-

"[INFO] Running TestSuite
1524549883598   geckodriver INFO    geckodriver 0.20.0
1524549883615   geckodriver INFO    Listening on 127.0.0.1:14395
1524549883939   mozrunner::runner   INFO    Running command: "/usr/lib/firefox/firefox" "-marionette" "-profile" "/tmp/rust_mozprofile.78vmBc1aqdpF"
1524549883941   geckodriver::marionette TRACE     connection attempt 0/600
ExceptionHandler::GenerateDump cloned child 6290
ExceptionHandler::SendContinueSignalToChild sent continue signal to child
ExceptionHandler::WaitForContinueSignal waiting for continue signal...
1524549884041   geckodriver::marionette TRACE     connection attempt 1/600
1524549884141   webdriver::server   DEBUG   <- 500 Internal Server Error {"value":{"error":"unknown error","message":"Process unexpectedly closed with status signal","stacktrace":""}}
Msg Process unexpectedly closed with status signal
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
System info: host: 'Unknown', ip: 'Unknown', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-96-generic', java.version: '1.8.0_131'
Driver info: driver.version: FirefoxDriver
remote stacktrace: 

Firefox version -60.0b10 Selenium -3.11.0 Using Gecko driver" Firefox版本-60.0b10 Selenium -3.11.0使用Gecko驱动程序”

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

1524549884141   webdriver::server   DEBUG   <- 500 Internal Server Error {"value":{"error":"unknown error","message":"Process unexpectedly closed with status signal","stacktrace":""}}

...implies that the marionette wasn't able to initiate an active connection with the WebClient ie Firefox browser. ...暗示木偶无法启动与WebClient(Firefox浏览器)的活动连接。

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

  • Your Selenium Client version is 3.11.0 . 您的Selenium Client版本是3.11.0
  • Your JDK version is 1.8.0_131 which is pretty ancient. 您的JDK版本1.8.0_131 ,这非常古老。
  • Your GeckoDriver version is v0.20.0 . 您的GeckoDriver版本是v0.20.0
  • Your Firefox version is unknown to us. 我们不知道您的Firefox版本。

So there is a clear mismatch between the JDK v8u131 , Selenium Client v3.11.0 and GeckoDriver v0.20.0 . 因此, JDK v8u131Selenium Client v3.11.0GeckoDriver v0.20.0之间显然不匹配。

Solution

  • Upgrade JDK to recent levels JDK 8u162 . JDK升级到最新级别的JDK 8u162
  • Upgrade GeckoDriver to GeckoDriver v0.20.1 level. 升级GeckoDriverGeckoDriver v0.20.1水平。
  • Ensure that GeckoDriver is present in the specified location as per your code block. 确保根据您的代码块, GeckoDriver位于指定位置。
  • Ensure that GeckoDriver is having executable permission for non-root users. 确保GeckoDriver非root用户具有可执行权限
  • Upgrade Firefox version to Firefox v59.0.2 levels. Firefox版本升级到Firefox v59.0.2级别。
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only. 通过IDE 清理 项目工作区 ,并仅使用必需的依赖项重建项目。
  • Use CCleaner tool to wipe off all the OS chores before and after the execution of your Test Suite . 在执行测试套件之前和之后,使用CCleaner工具清除所有操作系统杂项。
  • 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 as a non-root user. 以非root用户身份执行Test
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully. 始终在tearDown(){}方法内调用driver.quit() ,以优雅地关闭和破坏WebDriverWeb Client实例。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM