Selenium Python:避免匿名模式

Selenium Python:避免匿名模式,python,selenium,Python,Selenium,在Mac上使用此代码: from selenium import webdriver driver = webdriver.Chrome() driver.get("https://www.test.com/") button = driver.find_element_by_class_name('asdf') button.click().send_keys(os.getcwd()+"/image.png") 当我运行它时,它会打开一个匿名模式的Chrome窗口,但我不想这样做,事实上

在Mac上使用此代码:

from selenium import webdriver

driver = webdriver.Chrome()

driver.get("https://www.test.com/")
button = driver.find_element_by_class_name('asdf')
button.click().send_keys(os.getcwd()+"/image.png")
当我运行它时,它会打开一个匿名模式的Chrome窗口,但我不想这样做,事实上,我想打开一个普通的Chrome会话


如何?

当你正常运行Chrome时,它是以匿名模式启动的吗?不,它是以普通会话启动的。这可能会有所帮助