不废话,直接进入主题,本次演示如何启动chrome,且指定默认的profile
html
下载chromedriverweb
地址:http://chromedriver.storage.googleapis.com/index.html?path=2.33/chrome
特别注意:看notes.txt注意版本号必定要匹配啊,若是chromedriver版本和你的chrome版本不匹配那就可能启动不了!!!!!api
实战代码ide
from selenium import webdriver path="chromedriver.exe所在的完整路径" option=webdriver.ChromeOptions() #用chrome地址栏输入chrome://version/,查看本身的【我的资料路径】 option.add_argument('--user-data-dir=上面查看的我的资料路径写这里') driver=webdriver.Chrome(executable_path=path,chrome_options=option) #return driver