selenium加载浏览器配置文件

谷歌浏览器:

google_path=r'--user-data-dir=C:\Users\jdm\AppData\Local\Google\Chrome\User Data'

option=webdriver.ChromeOptions()

option.add_argument(google_path)

driver=webdriver.Chrome(chrome_options=option)

 

火狐浏览器:

firefox_path=r'C:\Users\jdm\AppData\Roaming\Mozilla\Firefox\Profiles\7elc1ibd.default'

profile=webdriver.FirefoxProfile(firefox_path)

driver=webdriver.Firefox(profile)

 

posted @ 2018-08-30 13:19  水工  阅读(357)  评论(0)    收藏  举报