首先查看chrome的版本下载chromedriver到chrome的根目录
1,查看chrome版本 chrome://version/
2,下载对应chrome版本的chromedriver
下载地址:http://chromedriver.storage.googleapis.com/index.html
3,将chromedriver.exe放到chrome.exe同一个路径
4,通过cmd启动一个chrome浏览器
chrome.exe --remote-debugging-port=9222 --user-data-dir="C:\selenum\AutomationProfile"
5,通过python程序连接浏览器进行操作
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
chrome_driver = "C:\\Users\\Administrator\\AppData\\Local\\Google\\Chrome\\Application\\chromedriver.exe"
driver = webdriver.Chrome(chrome_driver, chrome_options=chrome_options)
print(driver.title)