【问题标题】:Where can I find a list of all available ChromeOptions with selenium?我在哪里可以找到所有可用的带有 selenium 的 ChromeOptions 的列表?
【发布时间】:2018-01-19 23:21:24
【问题描述】:

在哪里可以找到所有可用的带有 selenium 的 Chrome 选项的列表?

在 python 环境中使用 selenium 爬行时,我不得不在 chrome webdriver 中使用 flash。 所以我试图找到一个允许 Flash 的设置,我找到了这些答案。

https://sqa.stackexchange.com/questions/30312/enable-flash-player-on-chrome-62-while-running-selenium-test

Selenium.Chrome where can I find a list of all available ChromeOption arguments? C#

但是我很想找官方文档 关于这些论点:

  • profile.default_content_setting_values.plugins
  • profile.content_settings.plugin_whitelist.adobe-flash-player

我认为这是存在的,因为有些人说了以上两个答案。 但我找不到。

【问题讨论】:

    标签: python selenium google-chrome selenium-chromedriver chrome-options


    【解决方案1】:
    1. 在 chrome 地址栏中打开 chrome://version
    2. 打开Profile Path:的文件夹,会有一个文件perference

    3. 复制并打开perference文件,它是一个JSON文件,你可以使用JSON格式器或JSON viewer online
      重要,请打开复制的一份,以免更改后损坏您的 chrome。

    4. 我认为profile.content_settings下的flash相关配置

    5. 在chrome地址栏中打开chrome://settings/content/flash,做你想要的flash设置,你的更改将更新到perference文件中,
    6. 找出更新和复制的perference 文件之间的区别。 不同之处应该是您想要 chrome 偏好。
    7. 在构建 ChromeOptions 时设置偏好,例如 profile.content_settings.xxx=xxx

    或者,您可以在当前用户配置文件中预先配置闪存设置(chrome://settings/content/flash)并使用用户配置文件来构建 ChromeOptions。

    一些参考:

    政策更接近于使用注册表/系统级别设置来影响一台机器上的所有用户;用户配置文件下的偏好工作只影响一个用户,用户可以使用它来自定义策略设置。但策略的优先级高于偏好。

    【讨论】:

    • 我想我必须了解 chrome 配置文件,但这个答案对我很有帮助。谢谢你的回答。
    【解决方案2】:

    这里是使用最广泛的ChromeDriver属性和ChromeOptions的链接:

    【讨论】:

      猜你喜欢
      • 2021-10-09
      • 2021-06-11
      • 2010-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多