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关闭

猜你喜欢

转载自blog.csdn.net/a12355556/article/details/112551931