1

I would like to run a selenium-test using headless chrome.

First I downloaded the chromedriver and passed its location as parameter:

null=open('/dev/null','wb')
cmd = ['java','-Djava.security.egd=file:/dev/./urandom','-jar','-Dwebdriver.chrome.driver=res/chromedriver_x64_26.0.1383.0','selenium-server-standalone.jar')]
proc = subprocess.Popen(cmd,stderr=null,stdout=null,preexec_fn=os.setsid)

Driver and display:

sel.driver = webdriver.Remote(
command_executor = 'http://127.0.0.1:4444/wd/hub',
desired_capabilities={'browserName': 'chrome'
                            })
display = Display(visible=0, size=(1024, 768))
display.start()

The tests are running fine, however chrome is not headless and is opened with the first test.

Jakob Bowyer
  • 33,878
  • 8
  • 76
  • 91
Kesandal
  • 1,263
  • 4
  • 11
  • 15
  • 1
    Here's your answer: http://stackoverflow.com/questions/4335717/selenium-and-headless-environment . I've tried this tons of times on OSX with no luck. Hope it works for you tho :) (What you practically do is shoot all graphical output into a virtual dummy screen) –  Mar 06 '13 at 23:21

0 Answers0