python - 删除由 selenium/chromedriver 传递给 chrome 的参数

标签 python selenium webdriver selenium-webdriver selenium-chromedriver

我将 selenium 与 python 和 chromium/chromedriver 结合使用。我想删除传递给 chrome 的开关(例如 --full-memory-crash-report),但到目前为止我只能找到如何添加更多开关。

我当前的设置:

from selenium import webdriver
driver = webdriver.Chrome(executable_path="/path/to/chromedriver")
driver.get(someurl)

据我所知,这可以用来添加参数:

from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--some-switch")
driver = webdriver.Chrome(chrome_options=chrome_options)

那么,我该如何摆脱默认参数或清除所有默认参数并仅传递自定义列表?

最佳答案

它帮助了我:

options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["test-type"])
options.add_argument("--incognito")
driver = webdriver.Chrome(options=options)

在这里找到解决方案 https://help.applitools.com/hc/en-us/articles/360007189411--Chrome-is-being-controlled-by-automated-test-software-notification

关于python - 删除由 selenium/chromedriver 传递给 chrome 的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16529524/

相关文章:

javascript - 在执行其余测试时保持 NodeJs 服务器运行

用于角度应用程序的 Java webdriver 不是 Protractor ?

python - OpenERP( View )-更改选择字段的外观? (又名单选按钮)

python-3.x - Python - 它被认为更适合抓取 : selenium or beautifulsoup with selenium?

python - Flask 重定向时返回 JWT token

selenium - 您如何在 Selenium 库/机器人框架中发送特殊 key ?

python - selenium.common.exceptions.WebDriverException : Message: Service chromedriver unexpectedly exited

java - 通过优先考虑测试功能来逐步测试我的应用程序?

python - GeoDjango 和混合器。 'PointField'没有属性 '_meta'

python - 根据 pandas 数据框索引删除数据行