无法在firefox Jenkins上运行自动化 [英] Unable to run automation on firefox Jenkins

查看:179
本文介绍了无法在firefox Jenkins上运行自动化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu服务器上最近安装的Jenkins上运行自动化项目时遇到了麻烦。我有以下错误:

  Selenium :: WebDriver :: Error :: WebDriverError:无法获取稳定的Firefox连接60秒(127.0.0.1:7055)
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:90:in` connect_until_stable'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:55:in`block in launch'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/socket_lock.rb:43:in`locked'
/ var / lib / gems /2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:51:in`launch'
/var/lib/gems/2.3.0/gems/ selenium-webdriver-2.53.0 / lib / selenium / webdriver / firefox / bridge.rb:43:在`initialize'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0 /lib/selenium/webdriver/common/driver.rb:53:in`new'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/ common / driver.rb:53:在`f或'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver.rb:84:in`为'
/ var / lib / gems / 2.3.0 / gems / watir-webdriver-0.9.1 / lib / watir-webdriver / browser.rb:46:在`initialize'
/ var / lib / jenkins / workspace / JobScience / lib / New_Automation /Test/test_basic.rb:15:in`new'
/var/lib/jenkins/workspace/JobScience/lib/New_Automation/Test/test_basic.rb:15:in`setup'
code>

我读过我应该更新selenium-webdriver gem,但是我已经更新了它。在jenkins中也安装了firefox插件,仍然不能正常工作。

解决方案

连接60秒,你会发现这是一个相当普遍的问题。您也会看到,它可能是由许多事情造成的。




  • FF和Webdriver之间的版本冲突(最常见)您没有运行Firefox的最新版本,和/或使用最新的硒-webdriver gem。
  • 权限问题:jenkins在执行程序系统上使用的帐户没有实际执行firefox的权限。如果您正在通过手动登录到执行器系统来测试此操作,请确保您使用的是与Jenkins相同的用户。

  • 没有显示:因为大多数jenkins执行者无法运行。您可能需要设置一个环境变量,比如 export DISPLAY =:0 ,或者运行一个像XVFB(虚拟帧缓冲区)的程序,或者使用无头的宝石XVFB),所以Firefox不畏惧缺乏显示。



最初的故障排除步骤是将您的jenkins脚本改为尝试启动firefox本身(而不是通过webdriver),If它运行,然后通常排除权限或无头问题,所以这个问题是在webdriver和firefox之间。如果出现错误,可能会显示问题是否是权限问题,或者是否显示不正确。

你基本上需要消除这个问题的所有可能的原因,因为你的搜索将揭示有很多潜在的原因和解决方案。这是一个小样本(是的,这些都是不同的SO问题,尽管标题几乎相同):


I'm having trouble running the automation project on a recently installed Jenkins on a Ubuntu server. I'm having the following error:

Selenium::WebDriver::Error::WebDriverError: unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:90:in `connect_until_stable'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:55:in `block in launch'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/socket_lock.rb:43:in `locked'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:51:in `launch'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/bridge.rb:43:in `initialize'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/driver.rb:53:in `new'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/driver.rb:53:in `for'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver.rb:84:in `for'
/var/lib/gems/2.3.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/browser.rb:46:in `initialize'
/var/lib/jenkins/workspace/JobScience/lib/New_Automation/Test/test_basic.rb:15:in `new'
/var/lib/jenkins/workspace/JobScience/lib/New_Automation/Test/test_basic.rb:15:in `setup'

I've read that I should update the selenium-webdriver gem, but I have it up to date. Also installed the firefox plugins in jenkins and still not working.

解决方案

If you just search SO for "Jenkins unable to obtain stable firefox connection in 60 seconds" you will find that this is a fairly common problem. You will also see that it can be caused by a number of things.

  • Versioning conflict between FF and Webdriver: (most common) usually because you are not running latest version of firefox, and/or using latest selenium-webdriver gem.
  • Permissions issue: account being used by jenkins on the executor system does not have permission to actually execute firefox. If you are testing this by logging into the executor system manually be sure you are using the same user that Jenkins does.
  • No display: caused because most jenkins executors run headless. You may need to set an environment variable such as export DISPLAY=:0, or run a program like XVFB (a virtual frame buffer), or use the headless gem (which wraps XVFB), so firefox doesn't balk at the lack of a display.

A good initial troubleshooting step is to alter your jenkins script to just have it try to launch firefox itself (not via webdriver), If it runs, then that typically rules out permissions or headless issues, so the issue is between webdriver and firefox. If you get an error, it will likely indicate if the problem is permissions, or lack of a display.

You basically need to eliminate all the possible causes for this issue, which as your search will reveal there are many potential causes and solutions for this. Here's a small sample (yes, each of these is a different SO question, despite the nearly identical titles):

这篇关于无法在firefox Jenkins上运行自动化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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