2014-03-13 12 views
0

Xvfb를 사용하여 cron 헤드리스를 통해 Selenium Scripts를 실행하려고합니다. 쉘 스크립트의 코드는이Cron을 사용하여 셀레늄 Webdriver를 헤드리스로 실행

export PATH=$PATH 
Xvfb :10 -ac & 
gnome-terminal -e export DISPLAY=:10 & 
gnome-terminal -e firefox & 
gnome-terminal -e export DISPLAY=:10 & 
gnome-terminal -e firefox & 
cd wait/test/ 
sh deploy.sh 

과 같은 형태하지만이 같은 eror 뭔가 점점 오전 : 어떤 도움을 주시면 감사하겠습니다

Failed to parse arguments: Cannot open display: 
Failed to parse arguments: Cannot open display: 
Failed to parse arguments: Cannot open display: 
Failed to parse arguments: Cannot open display: 
[dix] Could not init font path element /usr/share/fonts/X11/cyrillic, removing from list! 
[dix] Could not init font path element /usr/share/fonts/X11/100dpi/:unscaled, removing from list! 
[dix] Could not init font path element /usr/share/fonts/X11/75dpi/:unscaled, removing from list! 
[dix] Could not init font path element /usr/share/fonts/X11/100dpi, removing from list! 
[dix] Could not init font path element /usr/share/fonts/X11/75dpi, removing from list! 
[dix] Could not init font path element /var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType, removing from list! 
Traceback (most recent call last): 
    File "runner.py", line 7, in <module> 
    from test import root 
    File "/home/user/Tests/redirect/wait/test/ScrapyCrawl/test.py", line 47, in <module> 
    class root (unittest.TestCase): 
    File "/home/user/Tests/redirect/wait/test/ScrapyCrawl/test.py", line 49, in root 
    driver = webdriver.Firefox() 
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 59, in __init__ 
    self.binary, timeout), 
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__ 
    self.binary.launch_browser(self.profile) 
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 61, in launch_browser 
    self._wait_until_connectable() 
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 100, in _wait_until_connectable 
    self._get_firefox_output()) 
selenium.common.exceptions.WebDriverException: Message: 'The browser appears to have exited before we could connect. The output was: Error: no display specified\n' 

합니다. 감사.

답변

0

나는이 문제를 해결하기 위해를 사용했다. 그것은 Xvfb와 Xephyr를위한 파이썬 래퍼입니다. 더 많은 정보는 여기에서 찾을 수 있습니다 : pyvirtualdisplay