You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何用Python连接用户手动启动的Microsoft Edge浏览器?

问题:无法连接手动启动的Edge浏览器

已实现的功能

  • 能够连接通过以下命令启动的Edge浏览器:
    "c:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --remote-debugging-port=9244 --user-data-dir="C:\Users\user\OneDrive\Plocha\záložky\msedge1"
    
    注意:该命令必须指定与Edge默认用户数据目录(路径为C:\Users\user\AppData\Local\Microsoft\Edge\User Data)不同的用户数据目录

未解决的问题

目标是连接用户手动启动的Edge浏览器,尝试通过netstat -AB命令查找Edge进程对应的端口,将对应的127.0.0.1:端口号填入脚本后运行出现错误。

使用的Python脚本:

import selenium
from selenium import webdriver
from selenium.webdriver.edge.options import Options
from selenium.webdriver.edge.service import Service

edge_options = Options()
edge_options.add_experimental_option("debuggerAddress","127.0.0.1:55718")

edge_options.use_chromium = True
s = Service('C:/Users/WDAGUtilityAccount/Downloads/edgedriver_win64/msedgedriver.exe')
driver = webdriver.Edge(service = s, options = edge_options)

print(driver.title)

内容的提问来源于stack exchange,提问作者Justin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 09:23:30