0
2

More than 1 year has passed since last update.

python selenium

Last updated at Posted at 2020-07-01

#ページ全体のスクリーンショット

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options

# ブラウザーを起動
options = Options()
options.add_argument('--headless')
driver = webdriver.Chrome('/Desktop/selenium/chromedriver',  options=options)

driver.get("https://www.yahoo.co.jp/")

w = driver.execute_script('return document.body.scrollWidth')
h = driver.execute_script('return document.body.scrollHeight')
driver.set_window_size(w, h)
driver.save_screenshot('{保存先path}')

# ブラウザを終了する。
driver.close()

setup

$ pip install selenium
$ brew install chromedriver
$ pip install webdriver_manager

options一覧
selenium API検索

0
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
0
2