在无头 EC2 机器上运行 selenium?

发布于 2024-10-25 01:28:19 字数 1341 浏览 4 评论 0原文

我有一个运行 Ubuntu 的无头 EC2 M1.Small 实例。我一直在尝试使用它来运行用 Ruby 编码的硒测试。我正在运行 selenium 服务器 2.0b3 (最新)。

我已启用 XVFB:

$ sudo startx -- which Xvfb :1 -screen 0 1024x768x24 2>&1 >/dev/null & [1]1119

$ DISPLAY=:1 java -jar Automation/ruby-selenium-framework/selenium-server-1.0.3/selenium-server.jar > /tmp/selenium_log.log & [2]1245

然后运行我的代码:

$ ./BTRuby.rb coverage_

我在硒日志中得到以下输出:

14:11:27.448 INFO - Command request: getNewBrowserSession[*firefox, URL, , ] on session null
14:11:27.448 INFO - creating new remote session
14:11:27.448 INFO - Allocated session 4b1395b136174ab798eddd6a59d8e308 for URL, launching...
14:11:27.488 INFO - Preparing Firefox profile...
14:11:30.709 INFO - Launching Firefox...
14:11:35.873 INFO - Got result: OK,4b1395b136174ab798eddd6a59d8e308 on session 4b1395b136174ab798eddd6a59d8e308
14:11:35.878 INFO - Command request: setTimeout[30000000, ] on session 4b1395b136174ab798eddd6a59d8e308
14:11:35.937 INFO - Got result: OK on session 4b1395b136174ab798eddd6a59d8e308
14:11:36.007 INFO - Command request: open[URL, ] on session 4b1395b136174ab798eddd6a59d8e308

任何人都可以提供任何帮助吗?它似乎挂在最后一条 INFO 行上。

顺便说一句,URL 变量是一个有效的 URL,我为了这个问题而删除了它

I have a headless EC2 M1.Small instance running Ubuntu. I have been trying to use it to run a selenium test coded in Ruby. I am running selenium server 2.0b3 (the latest).

i have enabled XVFB:

$ sudo startx -- which Xvfb :1 -screen 0 1024x768x24 2>&1 >/dev/null &
[1] 1119

$ DISPLAY=:1 java -jar Automation/ruby-selenium-framework/selenium-server-1.0.3/selenium-server.jar > /tmp/selenium_log.log &
[2] 1245

And then run my code:

$ ./BTRuby.rb coverage_

I get the following output to the selenium log:

14:11:27.448 INFO - Command request: getNewBrowserSession[*firefox, URL, , ] on session null
14:11:27.448 INFO - creating new remote session
14:11:27.448 INFO - Allocated session 4b1395b136174ab798eddd6a59d8e308 for URL, launching...
14:11:27.488 INFO - Preparing Firefox profile...
14:11:30.709 INFO - Launching Firefox...
14:11:35.873 INFO - Got result: OK,4b1395b136174ab798eddd6a59d8e308 on session 4b1395b136174ab798eddd6a59d8e308
14:11:35.878 INFO - Command request: setTimeout[30000000, ] on session 4b1395b136174ab798eddd6a59d8e308
14:11:35.937 INFO - Got result: OK on session 4b1395b136174ab798eddd6a59d8e308
14:11:36.007 INFO - Command request: open[URL, ] on session 4b1395b136174ab798eddd6a59d8e308

Can anyone provide any help? It just seems to hang at this last INFO line.

BTW, the URL variable is a valid URL that I have stripped out for purposes of this question

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

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

发布评论

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

评论(1

遮云壑 2024-11-01 01:28:19

sudo startx --which Xvfb :1 -screen 0 1024x768x24 2>&1>/dev/null &

显示=:1 java -jar selenium-server-1.0.3/selenium-server.jar > /tmp/selenium_log.log &

能够成功

sudo startx -- which Xvfb :1 -screen 0 1024x768x24 2>&1 >/dev/null &

DISPLAY=:1 java -jar selenium-server-1.0.3/selenium-server.jar > /tmp/selenium_log.log &

was able to do the trick

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