我们如何使用Selenium Python以其他用户身份打开Goog​​le chrome?

时间:2019-09-26 11:34:01

标签: python selenium selenium-webdriver

我正在尝试使用Selenium和Python以“以其他用户身份”打开Chrome浏览器。我该怎么办?

1 个答案:

答案 0 :(得分:1)

非常简单,只需add_argumentchrome_options

from selenium import webdriver

options = webdriver.ChromeOptions() 
options.add_argument("user-data-dir=C:\\Path") #Path to your chrome profile
w = webdriver.Chrome(executable_path=r'C:\Users\chromedriver.exe', chrome_options=options)