python - 开发者模式扩展在 Chrome 中弹出

标签 python google-chrome selenium

为什么当我启动一个简单的脚本时,我会得到下面的图像(太低,无法在此处显示图像)。

基本上它给了我:开发者模式扩展在 Chrome 中弹出

从 Selenium 导入网络驱动程序

driver = webdriver.Chrome()
driver.get('http://google.com.uk')
driver.close()

显然这是一个快速修复:

ChromeOptions options = new ChromeOptions();
options.addArguments("chrome.switches","--disable-extensions");
System.setProperty("webdriver.chrome.driver",(System.getProperty("user.dir") + "//src//test//resources//chromedriver_new.exe"));
driver = new ChromeDriver(options);

我的问题是,如果没有一些创可贴解决方案,我该如何摆脱它?我昨天没有得到这个。有没有办法或只能重新安装。

enter image description here

最佳答案

要摆脱 Chrome 浏览器中弹出的开发者模式扩展,您可以使用以下代码块:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("start-maximized")
options.add_argument("disable-infobars")
options.add_argument("--disable-extensions")
driver = webdriver.Chrome(chrome_options=options, executable_path=r'C:\path\to\chromedriver.exe')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()

引用

您可以在以下位置找到详细讨论:

关于python - 开发者模式扩展在 Chrome 中弹出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47765944/

相关文章:

google-chrome - 谷歌如何计算chrome中的等待时间和接收时间?

google-chrome - Chrome 桌面上的 "Articles for you"建议(Chrome 内容建议)

css - 当元素高于约 32,000 像素时,Chrome 中的背景渐变会中断

javascript - 从下拉菜单中逐页阅读 - 在第二页找不到下拉菜单

selenium - 处理多个 Capybara React-select 下拉菜单?

python - 我的简单 tkinter 计算器脚本仅在通过 IDLE 运行时才有效。为什么?

python - Django 验证器函数的返回值存储在哪里?

python - 在 Python 中精确地要求一组关键字参数中的一个的最佳方法?

java - 如何使用selenium webdriver删除mysql中的现有数据

python - pkg_resources.DistributionNotFound : PIL