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)
标签:webdriver,浏览器,chrome,Selenium,driver,接管,9222,options,selenium 来源: https://www.cnblogs.com/jruing/p/15988386.html