ruby – 在无头EC2机器上运行硒?

我有一个无头的EC2 M1.Small实例运行Ubuntu.我一直试图用它来运行用
Ruby编码的selenium测试.我正在运行selenium server 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_

我得到以下输出到selenium日志:

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

最佳答案 sudo startx – 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&

能够做到这一点

点赞