SeleniumとChromeウェブブラウザで使用できるオプションについてのドキュメントはどこにありますか? Webブラウザで(クレデンシャルを取得するため)リンクを開きたいが、対応するファイル(.pdfまたは.tiffまたは.jpeg)をダウンロードしない。私はPython 2.7、selenium 3.0.1、およびChrome Version 54.0.2840.99(およびchromedriver.exe)をWindows 7 Laptopで使用しています。ChromeでSelenium Pythonバインディングを使用してファイルをダウンロードする方法を制御する
# Chrome web browser
options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
#options.add_argument('--disable-download-notification') #doesn't seems to work
#options.add_experimental_option("prefs", {"download.default_directory","C:\Users\xxx\downloads\Test"}) # doesn't work
#options.add_experimental_option("prefs", {"download.prompt_for_download": False}) # doesn't seems to work
#options.add_experimental_option("prefs", {'profile.default_content_settings': {'images': 2}})# this will disable image loading in the browser
options.add_argument("user-agent="+user_agent_profile)
driver_main = webdriver.Chrome(chrome_options=options)
# opening the web application portail
driver_main.get("https://my_link")
このトピックについては多くの議論がありましたが、解決策はありません。たとえば、次のようにしながら、(私も "偽" としてみてください)
add_experimental_option("prefs", {"download.prompt_for_download": False})
を::
add_argument("user-agent="+user_agent_profile)
add_experimental_option("prefs", {"download.default_directory","C:\Users\xxx\downloads\Test"})
がため
は同じ私のために動作しません。
うまくいくようです!
私が間違っているかを理解することを確認していない
私が得た問題は、それがファイル私は名前のファイル(1)ファイルとのリンクを開くたびにダウンロードして開始することである(2).... file(99)then 100で始まり、ポップアップウィンドウ "Save As"を開きます。だから、私はそのファイルをまったくダウンロードしないでください、または "ごみ箱"内の特定のフォルダに移動することはできません。
add_argumentとadd_argumentでどのオプションを使用することができますか? //について/私が直接対応にあなたがデフォルトのディレクトリに宣言たくさん
乾杯
ファビアン
変更ダウンロードパス - ' "download.default_directory"、 "C:\\ユーザー\\ xxxの\\ダウンロード\\テスト" '。それは私の魅力のように働く。 –