selenium针对当前窗口进行调试

使用cmd进入chrome浏览器的路径执行如下命令,创建一个端口为9527的窗口

chrome.exe --remote-debugging-port=9527 --user-data-dir="D:\selenium\AutomationProfile"

代码里面创建实例,调用driver即可

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_experimental_option("debuggerAddress","127.0.0.1:9527")
driver = webdriver.Chrome(options=options)

版权声明:本文为weixin_43930667原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。