2016-10-05 87 views
-3

我試圖在java中運行硒腳本。但每次我試圖創建Firefox驅動程序我得到這個錯誤無法運行java無頭硒

[WebDriverException: Failed to connect to binary FirefoxBinary(/usr/bin/firefox) on port 7055; process output follows: 

(process:32000): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed 

(firefox:32000): Gtk-WARNING **: Locale not supported by C library. 
    Using the fallback 'C' locale. 
Error: no display specified 

關於我的問題的一些背景。

  1. 我試圖運行硒與Ubuntu 14.0.4在AWS EC2
  2. 我已經嘗試安裝XVFB因此火狐可以在無頭的模式下運行,並與一些參考運行XVFB(https://medium.com/@griggheo/running-selenium-webdriver-tests-using-firefox-headless-mode-on-ubuntu-d32500bb6af2#.u0hrlct41https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
  3. 我可以在我的Java腳本硒「org.seleniumhq.selenium」%「硒的Java」%「2.53.1」沒有任何問題,運行硒Python腳本
  4. 我使用這個硒SBT,

任何人都可以幫助我運行使用Java的無頭硒?

回答

0

不知何故,我確實設置了java selenium headless。

我試圖用新鮮的Ubuntu 14.0.4機請點擊此鏈接

http://tobyho.com/2015/01/09/headless-browser-testing-xvfb/

,你必須採取一些筆記重要的事情!

  1. 確保您的硒版本與您的Firefox版本不兼容(在我的情況下,我使用硒2.53.1和Firefox 47.0.1

  2. 每次我是SSH我的服務器我必須重新運行xvfb並設置本地變量。