1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

python を使った firefox の画像キャプチャ

Posted at

python と selenium を使って、ホームページの画像をキャプチャするプログラムを書いてみました。

# -*- coding: utf-8 -*-
import sys

from selenium import webdriver
from selenium.webdriver import FirefoxOptions

'''
Firefox を起動して、画像キャプチャする
'''
if( len( sys.argv ) < 3 ):
	print "Usage: firefox.py [uri] [png]"
	sys.exit( 1 )

opts = FirefoxOptions()
opts.add_argument( "--headless" )
driver = webdriver.Firefox( firefox_options = opts )
driver.set_window_size( 1024,768 )

driver.get( sys.argv[1] )
driver.save_screenshot( sys.argv[2] )

driver.quit()


1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?