6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Chrome複数ダウンロード許可

Posted at

複数ダウンロード許可をSeleniumで行う

設定なし

from selenium import webdriver

url = "https://www.python.org/"

driver = webdriver.Chrome()
driver.get(url)

# 以降要素を取得しダウンロード処理

この状態で継続してダウンロードを行うと
複数ダウンロードの許可/ブロックのアラートが表示され、
どちらか選択しないとダウンロードしなくなる。

スクリーンショット 2025-02-08 075318.png

Optionを追加する

from selenium import webdriver

chrome_options = webdriver.ChromeOptions()

prefs = {'profile.default_content_setting_values.automatic_downloads': 1}  # 自動ダウンロードを有効化
chrome_options.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome(options=chrome_options)

driver.get(url)

1 : 許可
2 : 拒否

参考サイト

6
6
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
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?