當前位置:編程學習大全網 - 網站源碼 - python selenium的文件下載在chrome、IE下如何設置並實現

python selenium的文件下載在chrome、IE下如何設置並實現

設置下載目錄:

from?selenium?import?webdriver

chromedriver?=?"/usr/bin/chromedriver"

chromeOptions?=?webdriver.ChromeOptions()

prefs?=?{"download.default_directory":?"/path/download"}

chromeOptions.add_experimental_option("prefs",?prefs)

driver?=?webdriver.Chrome(executable_path=chromedriver,?chrome_options=chromeOptions)

設置代理:

from?selenium?import?webdriver

PROXY?=?"23.23.23.23:3128"?#?IP:PORT?or?HOST:PORT

chrome_options?=?webdriver.ChromeOptions()

chrome_options.add_argument('--proxy-server=")

IE的也差不多。

如果解決了您的問題請采納!

如果未解決請繼續追問

  • 上一篇:磚塊左右移動組成壹條線來消除
  • 下一篇:如何建設好壹個博客?
  • copyright 2024編程學習大全網