0
0

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 1 year has passed since last update.

PythonでSeleniumするときに書いておいたほうがいいコード

Posted at

メモとして残しておきます。

scraping.py
from selenium import webdriver
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service

options = webdriver.ChromeOptions()
options.add_argument("start-maximized")  # 画面表示を最大にする
options.add_experimental_option("excludeSwitches", ["enable-logging"])  # よくわからん長文をコンソールに表示させない
s = Service(ChromeDriverManager().install())  # これでwebドライバーのパスの指定不要、ブラウザのバージョンに合わせなくて済む
driver = webdriver.Chrome(service=s, options=options)
# ここまで定型句

driver.get("{WEBページのURL}")
# 以下ご自由に
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?