Selenium无法使用我的chrome配置文件打开页面[Python,chrome-webdriver]

时间:2016-09-23 06:07:00

标签: python python-2.7 python-3.x selenium selenium-webdriver

我试图让selenium用我的个人资料打开一个chrome会话,事情就是当我在驱动程序args中添加param“options”时它用我的个人资料打开chrome,但它保留在新标签中并且不打开任何页面,当我删除“选项”它打开铬没有我的个人资料,但它打开网页我真的不知道我做错了什么,我有这个代码:

options = webdriver.ChromeOptions()
options.add_argument('user-data-dir=C:\\Users\\---\\AppData\\Local\\Google\\Chrome\\User Data\\')
options.add_argument('-disable-extensions')
options.add_argument('start-maximized')
#this is the problematic line                                                             here
driver = webdriver.Chrome(executable_path='C:\chromedriver\chromedriver.exe', chrome_options=options)
driver.get('https://google.com/')

我想我需要在选项中添加用于打开网页的参数,但我无法找到如果那样的情况,谢谢

0 个答案:

没有答案