Created
October 1, 2014 09:19
-
-
Save anhldbk/b8d4647a64984e13bea9 to your computer and use it in GitHub Desktop.
Running Selenium Headless
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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