Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Last active February 25, 2016 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurozumi/43887cb5afecf2fe8755 to your computer and use it in GitHub Desktop.
Save kurozumi/43887cb5afecf2fe8755 to your computer and use it in GitHub Desktop.
【Python】Seleniumを使ってコマンドラインから標準入力したURLのページのスクリーンショットを撮影する方法
# 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