forked from pimuzzo/selenium-python-xvfb:
Forked from: khozzy/selenium-python-chrome
You can choose between:
docker build -t selenium .
(in the same path of your Dockerfile)
docker pull pimuzzo/selenium-python-xvfb
You can choose between:
docker run --name selenium -ti pimuzzo/selenium-python-xvfb bash
docker run -ti -v /your_local_dir:/home/something pimuzzo/selenium-python-xvfb python /home/something/your_file.py
Optional:
- You can specify the browser with the BROWSER environment variable
#!/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()
source: http://goo.gl/cmLS9Z