【发布时间】:2016-07-06 14:16:57
【问题描述】:
我开始在运行使用 selenium 和 chrome 驱动程序的 python 脚本时遇到问题,因此我想使用 python 禁用 chrome 驱动程序的扩展,而不会丢失驱动程序所在的路径。
目前我有以下内容:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
path_to_Ie = 'C:\\Python34\\ChromeDriver\\ChromeDriver.exe'
browser = webdriver.Chrome(executable_path = path_to_Ie)
url = 'https://wwww.test.com/'
browser.get(url)
我想添加以下几行:
chrome_options = Options()
chrome_options.add_argument("--disable-extensions")
browser = webdriver.Chrome(chrome_options=chrome_options)
知道如何合并这两个代码以使其正常工作吗?
非常感谢。
【问题讨论】: