Created
September 14, 2012 14:46
-
-
Save netmarkjp/3722354 to your computer and use it in GitHub Desktop.
screenshot by selenium
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 | |
#coding: utf-8 | |
import selenium | |
from selenium import webdriver | |
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile | |
def main(): | |
profile=FirefoxProfile() | |
profile.set_preference("general.useragent.override", | |
"Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3") | |
browser=webdriver.Firefox(profile) | |
browser.set_window_size(320,480) | |
browser.get('http://www.yahoo.co.jp/') | |
browser.save_screenshot('screen.png') | |
browser.quit() | |
if __name__=='__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment