Selenium使用自带浏览器自动化

需要找到chrome的User Data文件夹,替换下面代码中的路径

profile_directory = r'--user-data-dir=C:\Users\DXG\AppData\Local\Google\Chrome\User Data'
options = webdriver.ChromeOptions()
options.add_argument(profile_directory)
driver_path = r'D:/chromedriver/chromedriver.exe'
driver = webdriver.Chrome(executable_path=driver_path,options=options)

注意:在操作前必须先将chrome关闭

posted @ 2021-01-13 01:38  nmydt  阅读(333)  评论(0编辑  收藏  举报