Google chrome 设置特定的chrome驱动程序设置/选项
我需要通过Google chrome 设置特定的chrome驱动程序设置/选项,google-chrome,firefox,selenium,selenium-webdriver,chrome-options,Google Chrome,Firefox,Selenium,Selenium Webdriver,Chrome Options,我需要通过selenium取消选中“下载前询问每个文件的保存位置”Chrome设置: 我甚至不知道从哪里开始,因为没有包含所有可用选项的列表。而且,我还没有在chrome://flags/ 据我所知,我需要实例化Chrome选项或所需功能,设置特定的选项/功能,并将Chrome选项或所需功能实例传递给ChromeDriver构造函数 请注意,对于Firefox,情况有所不同,有一个页面,您可以通过Firefox Profile轻松找到设置并进行设置。很简单 我正在使用python绑定,但这不
selenium
取消选中“下载前询问每个文件的保存位置”Chrome
设置:
我甚至不知道从哪里开始,因为没有包含所有可用选项的列表。而且,我还没有在chrome://flags/
据我所知,我需要实例化Chrome选项
或所需功能
,设置特定的选项/功能,并将Chrome选项
或所需功能
实例传递给ChromeDriver
构造函数
请注意,对于Firefox,情况有所不同,有一个页面,您可以通过Firefox Profile
轻松找到设置并进行设置。很简单
我正在使用python绑定,但这不是一个要求,问题或多或少是通用的。通过检查此特定Chrome设置的元素源解决了这一问题: 检查了它的HTML:
<div class="checkbox">
<span class="controlled-setting-with-label">
<input id="prompt-for-download" type="checkbox" pref="download.prompt_for_download" metric="Options_AskForSaveLocation">
<span>
<label for="prompt-for-download" i18n-content="downloadLocationAskForSaveLocation">Ask where to save each file before downloading</label>
<span class="bubble-button controlled-setting-indicator" pref="download.prompt_for_download">
<div tabindex="0" role="button"></div></span>
</span>
</span>
</div>
from selenium import webdriver
options = webdriver.ChromeOptions()
prefs = {'download.prompt_for_download': False}
options.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome(chrome_options=options)
driver.get('http://stackoverflow.com')