Last active
February 25, 2016 07:57
-
-
Save kurozumi/43887cb5afecf2fe8755 to your computer and use it in GitHub Desktop.
【Python】Seleniumを使ってコマンドラインから標準入力したURLのページのスクリーンショットを撮影する方法
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
# coding: utf-8 | |
from selenium import webdriver | |
while True: | |
# 標準入力の値を取得 | |
url = raw_input() | |
# FireFox起動 | |
driver = webdriver.Firefox() | |
# 10秒のWait設定 | |
driver.implicitly_wait(10) | |
# ページ表示 | |
driver.get(url) | |
# スクリーンショット撮影 | |
driver.save_screenshot("%s.png" % driver.title) | |
# 終了 | |
driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment