Selenium接管已打开的浏览器
启动谷歌浏览器远程调试
chrome.exe --remote-debugging-port=9222 --user-data-dir="某个存在的文件夹地址"
新建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:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe" # webdriver路径
driver = webdriver.Chrome(chrome_driver, chrome_options=chrome_options)
print(driver.title)
本文来自博客园,作者:Jruing,转载请注明原文链接:https://www.cnblogs.com/jruing/p/15988386.html