Selenium 通过 jenkins 循环并在 cli 中拒绝许可

发布于 2024-12-28 20:36:04 字数 2351 浏览 1 评论 0原文

在努力获得适当的测试套件之后,我现在对以下事实感到非常失望:虽然尽可能遵循本教程(非常简单,对吧?) 在无头 Jenkins CI 构建上设置 Selenium 服务器机器,Jenkins在当前构建上不断循环,输出:

jenkins log output

所以我决定运行一个selenium在 ci 机器上手动构建,并得到以下结果:

user@machine:/var/log$ export DISPLAY=":99" && java -jar /var/lib/selenium/selenium-  server.jar -browserSessionReuse -htmlSuite *firefox http://staging.site.com /var/lib/jenkins/jobs/project/workspace/tests/selenium/testsuite.html /var/lib/jenkins/jobs/project/workspace/logs/selenium.html
24 janv. 2012 19:27:56 org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
19:27:59.927 INFO - Java: Sun Microsystems Inc. 20.0-b11
19:27:59.929 INFO - OS: Linux 3.0.0-14-generic amd64
19:27:59.951 INFO - v2.17.0, with Core v2.17.0. Built from revision 15540 
19:27:59.958 INFO - Will recycle browser sessions when possible. 
19:28:00.143 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
19:28:00.144 INFO - Version Jetty/5.1.x
19:28:00.145 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
19:28:00.147 INFO - Started HttpContext[/selenium-server,/selenium-server]
19:28:00.147 INFO - Started HttpContext[/,/]
19:28:00.183 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@16ba8602
19:28:00.184 INFO - Started HttpContext[/wd,/wd]
19:28:00.199 INFO - Started SocketListener on 0.0.0.0:4444
19:28:00.199 INFO - Started org.openqa.jetty.jetty.Server@6f7a29a1
HTML suite exception seen:
java.io.IOException: Permission denied
  at java.io.UnixFileSystem.createFileExclusively(Native Method)
  at java.io.File.createNewFile(File.java:900)
  at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:603)
  at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:287)
  at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:245)
  at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:54)
19:28:00.218 INFO - Shutting down...
19:28:00.220 INFO - Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=4444]

虽然理解输出并不难,但找到解决此问题的方法却很困难。

你们有可能已经遇到过这种事情吗?谢谢

After struggling to get proper testsuites, I'm now pretty disappointed by the fact that , while following as close as possible this tutorial (pretty straightforward, right ?) Setting up Selenium server on a headless Jenkins CI build machine, Jenkins keeps looping on the current build, outputting :

jenkins log output

So I decided to run a selenium build by hand on the ci machine, and got this :

user@machine:/var/log$ export DISPLAY=":99" && java -jar /var/lib/selenium/selenium-  server.jar -browserSessionReuse -htmlSuite *firefox http://staging.site.com /var/lib/jenkins/jobs/project/workspace/tests/selenium/testsuite.html /var/lib/jenkins/jobs/project/workspace/logs/selenium.html
24 janv. 2012 19:27:56 org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
19:27:59.927 INFO - Java: Sun Microsystems Inc. 20.0-b11
19:27:59.929 INFO - OS: Linux 3.0.0-14-generic amd64
19:27:59.951 INFO - v2.17.0, with Core v2.17.0. Built from revision 15540 
19:27:59.958 INFO - Will recycle browser sessions when possible. 
19:28:00.143 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
19:28:00.144 INFO - Version Jetty/5.1.x
19:28:00.145 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
19:28:00.147 INFO - Started HttpContext[/selenium-server,/selenium-server]
19:28:00.147 INFO - Started HttpContext[/,/]
19:28:00.183 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@16ba8602
19:28:00.184 INFO - Started HttpContext[/wd,/wd]
19:28:00.199 INFO - Started SocketListener on 0.0.0.0:4444
19:28:00.199 INFO - Started org.openqa.jetty.jetty.Server@6f7a29a1
HTML suite exception seen:
java.io.IOException: Permission denied
  at java.io.UnixFileSystem.createFileExclusively(Native Method)
  at java.io.File.createNewFile(File.java:900)
  at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:603)
  at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:287)
  at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:245)
  at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:54)
19:28:00.218 INFO - Shutting down...
19:28:00.220 INFO - Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=4444]

While understanding the output is'nt that hard, finding what to do to remove this issue is.

Any chance you guys already have been facing that kind of stuff ? Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧梦荧光笔 2025-01-04 20:36:04

我自己刚刚解决了这些问题,但是当我将它指向我的 .jar、testSuite 和报告文件时,我能够运行你的命令。我认为您的文件所在位置可能

/var/lib/selenium

是问题的一部分。尝试将它们放在您的用户有权限的地方,也许在除此之外

/home/USERNAME/selenium

,我唯一能说的是确保您的 .jar、testSuite 和报告文件有效。

另外(我假设这是复制并粘贴到堆栈溢出的错误)但是,您的命令的这一部分不正确

/var/lib/selenium/selenium-  server.jar

您没有从不正确的 jar 位置收到我期望的错误,所以我假设当您粘贴到 stackoverflow 时丢失了一些东西。

I only just got past these problems myself, but I was able to run your command when I pointed it at my .jar, testSuite and report file. I'm thinking that perhaps the location of your files under,

/var/lib/selenium

could be part of the problem. Try putting them where your user has permission perhaps under

/home/USERNAME/selenium

Other than that the only thing I can say is make sure your .jar, testSuite and report file are valid.

Also (I assume this is an error of copy and paste into stack overflow) but, this part of your command is incorrect

/var/lib/selenium/selenium-  server.jar

You are not getting the error I would expect from an incorrect jar location so I assume something was lost when you pasted to stackoverflow.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文