Skip to content

Instantly share code, notes, and snippets.

@anhldbk
Created October 1, 2014 09:19
Show Gist options
  • Save anhldbk/b8d4647a64984e13bea9 to your computer and use it in GitHub Desktop.
Save anhldbk/b8d4647a64984e13bea9 to your computer and use it in GitHub Desktop.
Running Selenium Headless
#!/usr/bin/env python
from pyvirtualdisplay import Display
from selenium import webdriver
display = Display(visible=0, size=(800, 600))
display.start()
# now Firefox will run in a virtual display.
# you will not see the browser.
browser = webdriver.Firefox()
browser.get('http://www.google.com')
print browser.title
browser.quit()
display.stop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment