June 8, 2011

Python - Selenium WebDriver - Capture Screenshot

Example of capturing a screenshot from Selenium WebDriver in Python:

 
#!/usr/bin/env python
from selenium import webdriver

browser = webdriver.Firefox()
browser.get('http://www.ubuntu.com/')
browser.save_screenshot('screenie.png')
browser.quit()

selenium/webdriver bindings for Python: http://pypi.python.org/pypi/selenium

Post a Comment