You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何获取Selenium中所有可用ChromeOptions的官方文档?

Hey there, I totally get your frustration—those ChromeOptions preferences for enabling Flash like profile.default_content_setting_values.plugins or profile.content_settings.plugin_whitelist.adobe-flash-player are surprisingly hard to track down in official docs. Here’s what I’ve learned from dealing with the same issue:

  • Check Chrome's own Preferences file
    These settings are actually part of Chrome's internal user profile preferences, not something explicitly documented in Selenium/ChromeDriver docs. Here's how to uncover them:

    1. Open Chrome and navigate to chrome://version/
    2. Locate the "Profile Path" entry, then open that folder on your system
    3. Find the Preferences file (it's a JSON file)
    4. Manually configure Flash permissions in Chrome (allow sites to run Flash, add specific sites to the whitelist), then compare the modified Preferences file with a backup of the original. The differences will show you exactly which parameters map to your Flash settings.
  • Refer to Chrome Enterprise/Policy Documentation
    While not directly tailored for Selenium, Chrome's Enterprise documentation and policy templates cover many content setting parameters that work with ChromeOptions. These docs outline how Chrome handles content permissions (including plugins like Flash) and can give you context for the parameters you're looking for.

  • Leverage Community Knowledge (Stack Overflow & Forums)
    Since official docs don't list every possible preference, most working Flash configurations come from community testing. Searching for questions like "enable Flash in ChromeDriver with Selenium Python" will pull up validated code snippets and parameter lists from other developers. For example, this is a commonly used working configuration:

    from selenium import webdriver
    
    chrome_options = webdriver.ChromeOptions()
    flash_prefs = {
        "profile.default_content_setting_values.plugins": 1,
        "profile.content_settings.plugin_whitelist.adobe-flash-player": 1,
        "profile.content_settings.exceptions.plugins.*,*.per_resource.adobe-flash-player": 1,
        "plugins.plugins_enabled": ["Adobe Flash Player"]
    }
    chrome_options.add_experimental_option("prefs", flash_prefs)
    driver = webdriver.Chrome(options=chrome_options)
    

    Just note that these parameters might change slightly with new Chrome versions, so always test against your specific browser/driver version.

  • ChromeDriver's Experimental Options Note
    The ChromeDriver docs do mention that you can pass Chrome preferences via add_experimental_option("prefs", prefs_dict), but they don't enumerate every possible preference key. This is because Chrome's internal preference set is large and frequently updated, so maintaining an exhaustive list isn't feasible.

Keep in mind that Flash is largely deprecated in modern browsers, so some of these settings might be removed or altered in newer Chrome versions. Always verify with your target Chrome version!

内容的提问来源于stack exchange,提问作者giraffeb

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:47:13