2
我無法通過cron運行rspec測試。我使用硒來訪問Firefox並測試登錄到頁面。在cron之外執行時,所有文件都可以正常工作。從我讀過的內容來看,問題可能在於cron需要一個顯示環境來運行像firefox這樣的程序。這是我卡住的地方,我如何設置一個硒的顯示環境從cron內啓動firefox。如何使用硒通過cron運行rspec測試
我試過設置顯示在crontab幾種方法..
*/25 * * * * /home/justin/test.sh --display=:0 > testlog
*/25 * * * * DISPLAY=:0; /home/justin/test.sh > testlog;
我也試過在腳本中設置吧..
#!/bin/sh
cd /home/justin/widget_ui_testing/
DISPLAY=:0
/home/justin/.rvm/bin/rvm exec /home/justin/.rvm/gems/ruby-1.9.2-p290/bin/rspec
-fdoc /home/justin/widget_ui_testing/spec/requests/log_in_spec.rb
錯誤消息我一直得到是
Selenium::WebDriver::Error::WebDriverError:
unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)
# ./spec/requests/log_in_spec.rb:22:in `block (2 levels) in <top (required)>'
我想知道是否有一種方法來改變selenium的代碼來運行firefox的一個speci展示。或者如果我錯過了一些東西。任何幫助將非常感激。