java Jenkins 无法启动 selenium 测试(等待创建配置文件超时)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7106994/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Jenkins can't launch selenium tests (Timed out waiting for profile to be created)
提问by okcorp
Jenkins can't launch selenium tests (ubuntu) error
Jenkins 无法启动 selenium 测试 (ubuntu) 错误
11:26:24.652 INFO - Started org.openqa.jetty.jetty.Server@ab50cd 11:26:24.738 INFO - Preparing Firefox profile... HTML suite exception seen: java.lang.RuntimeException: Timed out waiting for profile to be created! at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:360) at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:114) at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:83) at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchHTMLSuite(FirefoxChromeLauncher.java:405) at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchHTMLSuite(FirefoxLauncher.java:105) at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:121) at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:166) at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:556) at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:241) at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:201) at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:40)
11:26:24.652 信息 - 已启动 org.openqa.jetty.jetty.Server@ab50cd 11:26:24.738 信息 - 正在准备 Firefox 配置文件...看到 HTML 套件异常:java.lang.RuntimeException:等待配置文件超时创造了!在 org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:360) 在 org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:1114) .browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:83) 在 org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchHTMLSuite(FirefoxChromeLauncher.java:405) 在 org.openqa.selenium.server.browserlaunchers.FirefoxSuiteLauncherlauncher .java:105) 在 org.openqa.selenium.server。
OS - Ubuntu workstation 11 Jenkins & Selenium - last versions (installed as is it written on sites)
操作系统 - Ubuntu 工作站 11 Jenkins & Selenium - 最新版本(按照网站上写的方式安装)
It seems to me that user jenkins have not all the rights, because if i use the same line to execute in terminal, it works selenium starts Firefox & do the suite.
在我看来,用户 jenkins 并不拥有所有权限,因为如果我使用同一行在终端中执行,它会运行 selenium 启动 Firefox 并执行该套件。
I also put jenkins user in groop root but it also doesn't help.
我还将 jenkins 用户置于 groop root 中,但这也无济于事。
I'm not qualified in Linux but it seems than trouble is with rights of jenkins user, but i can mistake.
我在 Linux 中没有资格,但似乎 jenkins 用户的权利有问题,但我可能会犯错。
If somebody have solved the problem please write the solution.
如果有人解决了问题,请写出解决方案。
回答by mattbilson
I was recently having this issue too.
我最近也有这个问题。
I first tried the method mentioned here : http://www.spacevatican.org/2008/9/27/selenium-and-firefox-3However this fix now seems out of date, as the plugin maxVersion properties were all set to 8.something.
我首先尝试了这里提到的方法:http: //www.spacevatican.org/2008/9/27/selenium-and-firefox-3但是这个修复现在似乎已经过时了,因为插件 maxVersion 属性都设置为 8 。某物。
The way I fixed it (as mentioned here : http://www.centripetal.ca/blog/2011/02/07/getting-started-with-selenium-and-jenkins/) was to provide Selenium with a firefox profile.
我修复它的方式(如这里提到的:http: //www.centripetal.ca/blog/2011/02/07/getting-started-with-selenium-and-jenkins/)是为 Selenium 提供 firefox 配置文件。
Steps
脚步
- Open up Firefox profile manager : $ firefox -ProfileManager
- Create a new profile, called Selenium
- Now, when running the selenium command, add "-firefoxProfileTemplate "/home/{username}/.mozilla/firefox/{profile dir}" to the command. (where {username} is your username and {profile dir} is the profile directory, which for me was "6f2um01h.Selenium"
- 打开 Firefox 配置文件管理器:$ firefox -ProfileManager
- 创建一个名为 Selenium 的新配置文件
- 现在,在运行 selenium 命令时,将“-firefoxProfileTemplate”/home/{username}/.mozilla/firefox/{profile dir}”添加到命令中。(其中 {username} 是您的用户名,{profile dir} 是配置文件目录,对我来说是“6f2um01h.Selenium”
My final Selenium command was
我最后的 Selenium 命令是
$ sudo java -jar /var/lib/jenkins/tools/selenium/selenium-server.jar -htmlSuite *firefox http://google.com "/var/lib/jenkins/jobs/Selenium setup test/workspace/tests/test-testsuite.html" "/var/lib/jenkins/jobs/Selenium setup test/workspace/results/results.html" -log=/tmp/selenium.log -debug=true -firefoxProfileTemplate "/home/username/.mozilla/firefox/6f2um01h.Selenium"
I would also recommend copying and pasting the shell command that jenkins is using into Terminal, to save having to run it through Jenkins each time.
我还建议将 jenkins 使用的 shell 命令复制并粘贴到终端中,以节省每次都必须通过 Jenkins 运行它。
N.B. I'm currently finding that Selenium now hangs (and doesn't crash) on the next step of it's process (Launching Firefox) but this seems like a different bug which I've added to stackoverflow here : Selenium hangs when launching Firefox on Ubuntu
注意,我目前发现 Selenium 现在在其进程的下一步(启动 Firefox)中挂起(并且不会崩溃),但这似乎是我在此处添加到 stackoverflow 的一个不同错误:Selenium 在启动 Firefox 时挂起Ubuntu
回答by Clotho
I have similar issues. But the cause and solution are different.
我有类似的问题。但是原因和解决方法是不同的。
The program (I use python) hangs for a while, and then output:
程序(我用python)挂了一会儿,然后输出:
selenium.common.exceptions.WebDriverException: Message: 'The browser appears to have exited before we could connect. The output was: * LOG addons.xpi: startup\n*LOG addons.xpi: checkForChanges\n*** LOG addons.xpi: Opening database\n*** LOG addons.xpi: No changes found\nFailed to dlopen /usr/lib/libX11.so.6\ndlerror says: /usr/lib/libX11.so.6: wrong ELF class: ELFCLASS32\n'
selenium.common.exceptions.WebDriverException:消息:'浏览器似乎在我们可以连接之前已经退出。输出为:* LOG addons.xpi: startup\n*LOG addons.xpi: checkForChanges\n*** LOG addons.xpi: 打开数据库\n*** LOG addons.xpi: 未找到任何更改\n无法 dlopen / usr/lib/libX11.so.6\ndlerror 说:/usr/lib/libX11.so.6:错误的 ELF 类:ELFCLASS32\n'
It is because I have installed both 32 and 64 bit version of libX11. By removing libX11 32 bit version, the program works.
这是因为我同时安装了 32 位和 64 位版本的 libX11。通过删除 libX11 32 位版本,程序可以运行。
回答by mmalone
@mattbilson's solution didn't work for me, but I found a different solution to a problem with the same symtomps. I believe In the process of trying to debug the problem, multiple versions of Firefox had been installed, and not all from clean deb packages.
@mattbilson 的解决方案对我不起作用,但我找到了解决具有相同症状的问题的不同解决方案。我相信在尝试调试问题的过程中,已经安装了多个版本的Firefox,并且不是全部来自干净的deb包。
To fix the problem I did:
为了解决我所做的问题:
sudo apt-get purge firefox
sudo mv /usr/lib/firefox /usr/lib/firefox.bak
sudo apt-get install firefox=<MY_FIREFOX_VERSION>
After that I could run the Selenium JAR without any special parameters.
之后,我可以在没有任何特殊参数的情况下运行 Selenium JAR。