m0_65810755 2025-09-24 17:32 采纳率: 0%
浏览 11

Power Automate Desktop 启动新 Microsoft Edge报错:无法取得 Microsoft Edge 的控制权

Power Automate Desktop 启动新 Microsoft Edge报错:无法取得 Microsoft Edge 的控制权
该错误不是每次运行都发生,发生错误的概率大约在1%左右。
我比较迷惑的是,该步骤已经设置了超时:120s,但提示的报错信息中显示:
”No Edge window was found with a tab containing the specified title within the remaining timeout period** (0 seconds).“
有人知道原因吗?可以往什么方向调试啊?

img

以下是完整错误信息:
错误原因:
子流程: Submit,操作: 4,操作名称: 启动新 Microsoft Edge 错误消息: 无法取得 Microsoft Edge 的控制权。No Edge window was found with a tab containing the specified title within the remaining timeout period (0 seconds). Make sure the tab in the browser is available at the execution of the action or increase the "Timeout" parameter in the action. 其他信息: {}
Microsoft.Flow.RPA.Desktop.Modules.SDK.Extended.Exceptions.InternalActionException: 无法取得 Microsoft Edge 的控制权。No Edge window was found with a tab containing the specified title within the remaining timeout period (0 seconds). Make sure the tab in the browser is available at the execution of the action or increase the "Timeout" parameter in the action. ---> Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Common.Exceptions.BrowserLaunchException: 引发类型为“Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Common.Exceptions.BrowserLaunchException”的异常。 ---> System.TimeoutException: No Edge window was found with a tab containing the specified title within the remaining timeout period (0 seconds). Make sure the tab in the browser is available at the execution of the action or increase the "Timeout" parameter in the action 在 Microsoft.Flow.RPA.Desktop.UIAutomation.WebAutomation.Core.WebExtensionsBrowser.WebExtensionsBrowserLauncher.AttachToRunningBrowser(AttachMode attachMode, String title, String uri, TimeSpan timeout) 在 Microsoft.Flow.RPA.Desktop.UIAutomation.WebAutomation.Runtime.Actions.LocalWebAutomationRuntime.LaunchNewEdge(AutomationRoute route, String initialUrl, String edgeTabTitle, String edgeTabUrl, String dialogButtonToPress, LaunchNewEdgeMode operation, LaunchWindowState windowState, AttachMode attachMode, Boolean waitForWebPageToLoad, TimeSpan waitForPageToLoadTimeout, WebPageCourseOfActionIfDialogAppears courseOfActionIfDialogAppears, Boolean clearCache, Boolean clearCookies, TimeSpan timeout, PiPUserDataFolderMode pipUserDataFolderMode, String pipUserDataFolderPath, Boolean runInPip) --- 内部异常堆栈跟踪的结尾 --- 在 Microsoft.Flow.RPA.Desktop.UIAutomation.Core.Abstractions.ServiceRouter1.Invoke(MethodInfo targetMethod, Object[] args) --- 引发异常的上一位置中堆栈跟踪的末尾 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Reflection.DispatchProxyGenerator.Invoke(Object[] args) 在 generatedProxy_6.LaunchNewEdge(AutomationRoute , String , String , String , String , LaunchNewEdgeMode , LaunchWindowState , AttachMode , Boolean , TimeSpan , WebPageCourseOfActionIfDialogAppears , Boolean , Boolean , TimeSpan , PiPUserDataFolderMode , String , Boolean ) --- 远程异常堆栈跟踪结束 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 Microsoft.Flow.RPA.Desktop.UIAutomation.Shared.Rpc.RpcDispatchProxy1.GetRemoteResultOrThrow(ISerializer serializer, RPCMessage response, Type expectedResultType, Object additionalContext) 在 Microsoft.Flow.RPA.Desktop.UIAutomation.Shared.Rpc.RpcDispatchProxy1.Invoke(MethodInfo targetMethod, Object[] args) --- 引发异常的上一位置中堆栈跟踪的末尾 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Reflection.DispatchProxyGenerator.Invoke(Object[] args) 在 generatedProxy_2.LaunchNewEdge(AutomationRoute , String , String , String , String , LaunchNewEdgeMode , LaunchWindowState , AttachMode , Boolean , TimeSpan , WebPageCourseOfActionIfDialogAppears , Boolean , Boolean , TimeSpan , PiPUserDataFolderMode , String , Boolean ) 在 Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.WebAutomationRuntimeServiceProxy.<>c__DisplayClass26_0.b__0(IWebAutomationRuntime s) 在 Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.WebAutomationRuntimeServiceProxy.ExecuteSafe[T](Func2 action, TimeSpan timeout) 在 Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.WebAutomationRuntimeServiceProxy.LaunchNewEdge(AutomationRoute route, String initialUrl, String edgeTabTitle, String edgeTabUrl, String dialogButtonToPress, LaunchNewEdgeMode operation, LaunchWindowState windowState, AttachMode attachMode, Boolean waitForWebPageToLoad, TimeSpan waitForPageToLoadTimeout, WebPageCourseOfActionIfDialogAppears courseOfActionIfDialogAppears, Boolean clearCache, Boolean clearCookies, TimeSpan timeout, PiPUserDataFolderMode pipUserDataFolderMode, String pipUserDataFolderPath, Boolean runInPip) 在 Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.LaunchEdgeBase.<>c__DisplayClass74_0.b__0(IWebAutomationRuntime s) 在 Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.WebAutomationActionBase.PerformWebAutomationWithLogging[T](Func2 action, WebAutomationRuntimeLogData requestData, Func3 resultData) 在 Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.LaunchEdgeBase.Execute(ActionContext context) --- 内部异常堆栈跟踪的结尾 --- 在 Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.LaunchEdgeBase.Execute(ActionContext context) 在 Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary2 inputArguments, Dictionary2 outputArguments)

  • 写回答

3条回答 默认 最新

  • 檀越@新空间 2025-09-24 17:33
    关注

    下午好🌅🌅🌅
    本答案参考通义千问

    你遇到的 Power Automate Desktop (PAD) 启动 Microsoft Edge 时出现的错误信息是:

    “无法取得 Microsoft Edge 的控制权。No Edge window was found with a tab containing the specified title within the remaining timeout period (0 seconds).”

    这个错误虽然设置了 120 秒超时,但提示中显示 剩余时间为 0 秒,说明在执行过程中,Power Automate Desktop 并未成功等待到浏览器窗口的出现或匹配标题


    可能的原因分析

    1. Edge 浏览器启动失败或未正确加载

    • Edge 可能由于某些原因(如更新、权限问题、路径错误)未能正常启动。
    • 解决方案: 检查 Edge 是否可以手动打开,并确认其安装路径是否正确。

    2. 目标标签页标题不匹配

    • Power Automate Desktop 需要找到一个包含指定标题的标签页,如果该标题不匹配或尚未加载,就会报错。
    • 解决方案: 确保设置的 Edge 标题 是准确的,比如使用 https://example.comExample - Microsoft Edge

    3. 浏览器启动时间过长

    • 虽然设置了 120 秒超时,但在某些系统上,Edge 启动和页面加载可能超过此时间,尤其是当网络较慢或系统资源紧张时。
    • 解决方案: 增加超时时间至 240 秒以上,并确保浏览器初始化完成后再进行后续操作。

    4. Power Automate Desktop 的版本问题

    • 某些旧版本的 PAD 对 Edge 的支持可能存在兼容性问题。
    • 解决方案: 升级到最新版本的 Power Automate Desktop

    5. 浏览器自动弹出的对话框或广告干扰

    • 如果 Edge 在启动时弹出了登录窗口、广告或其他非预期页面,可能导致 PAD 无法识别目标标签页。
    • 解决方案: 设置 dialogButtonToPress 参数来自动处理弹窗(例如点击“同意”或“忽略”按钮)。

    🛠️ 建议的调试方向与解决步骤

    以下是 详细的调试和修复方案,按优先级排序:

    1. 检查 Edge 安装路径和权限

    • 确认 Edge 安装路径是否正确(默认为 C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe)。
    • 以管理员身份运行 Power Automate Desktop,避免权限不足导致的问题。

    2. 验证 Edge 标题匹配

    • 在“启动新 Microsoft Edge”操作中,设置正确的标题(如 https://example.comExample - Microsoft Edge)。
    • 不要使用模糊标题,例如 “Edge” 或 “New Tab”,这会导致匹配失败。

    3. 增加超时时间

    • Timeout 参数从 120 秒调整为 240 秒,以适应更慢的环境。
    • 示例代码片段:
      "Timeout": 240
      

    4. 处理浏览器弹窗

    • 使用 dialogButtonToPress 参数,指定要点击的按钮(如 "Accept""Ignore")。
    • 示例代码:
      "dialogButtonToPress": "Accept"
      

    5. 检查网络连接和浏览器性能

    • 确保网络稳定,避免因加载缓慢导致超时。
    • 关闭不必要的后台程序,释放系统资源。

    6. 更新 Power Automate Desktop

    7. 使用“查找窗口”动作辅助调试

    • 在启动 Edge 之前,先使用 “查找窗口” 动作,确认 Edge 是否已经存在或正在启动。
    • 这可以帮助你判断问题是出在启动阶段还是匹配阶段。

    🧪 修改后的配置示例(Power Automate Desktop 中的“启动新 Microsoft Edge”动作)

    {
      "action": "LaunchNewEdge",
      "parameters": {
        "url": "https://example.com",
        "edgeTabTitle": "Example - Microsoft Edge",
        "edgeTabUrl": "https://example.com",
        "timeout": 240,
        "dialogButtonToPress": "Accept"
      }
    }
    

    🔍 其他调试技巧

    | 技巧 | 说明 | |------|------| | 日志记录 | 在流程中添加 “写入日志” 动作,记录每一步的状态。 | | 截图功能 | 使用 “截屏” 动作,查看在报错时 Edge 是否已启动。 | | 模拟测试 | 在本地环境中多次运行流程,观察是否每次都会报错。 |


    总结

    | 关键点 | 解决方案 | |--------|----------| | Edge 启动失败 | 检查安装路径、权限、手动启动 Edge | | 标题不匹配 | 确保 edgeTabTitleedgeTabUrl 正确 | | 超时设置不足 | 增加 Timeout 到 240 秒以上 | | 弹窗干扰 | 设置 dialogButtonToPress 处理弹窗 | | 版本兼容性 | 升级到最新版 Power Automate Desktop |


    如果你愿意提供具体的流程截图或配置文件内容,我可以进一步帮助你定位问题。

    评论

报告相同问题?

问题事件

  • 创建了问题 9月24日