LoginSignup
0
1

More than 3 years have passed since last update.

【python】heliumでダウンロード先のフォルダを指定する

Last updated at Posted at 2021-05-31

heliumでもseleniumと同じ指定の仕方で、ダウンロード先のフォルダを指定できます。heliumを使ってダウンロードしたcsvファイルなどでごにょごにょしたい時にダウンロード先を明示できるので便利です。

from selenium.webdriver import ChromeOptions
from helium import *

options = ChromeOptions()
prefs = {"download.default_directory": r"C:\Users\user\Documents\helium_test"}
options.add_experimental_option('prefs', prefs)
start_chrome(options=options)
# heliumでダウンロード
kill_browser()

download.default_directoryで指定するフォルダ名はご自身の環境に合わせてください。
私はwindows10を使っておりますが、フォルダへのパスの最後の"\"は有っても無くても動作には影響がありませんでした。

0
1
1

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
1