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

如何通过TruClient关闭浏览器实例?回放新实例致事务失败求解

TruClient Browser Instance Management: Solutions to Your Questions

Hey there, let's tackle your two TruClient browser instance issues one by one:

1. How to Close Browser Instances in TruClient

Here are reliable methods tailored to different scenarios:

  • Use the built-in Close Browser step: This is the most straightforward approach. Add this step to your script, and it will close the browser instance linked to your current execution context. If multiple instances are running, you can specify the target browser via its title or URL in the step's parameters to close a specific one.
  • Custom JavaScript control: For more granular control, insert an Evaluate JavaScript step and run this command:
    TC.browser.close();
    
    This closes the browser window tied to your active TruClient script session, perfect for targeting the exact instance your script is interacting with.
  • Emergency process termination (last resort): If a browser instance becomes unresponsive, use an Execute Command step to kill the process directly. On Windows, run:
    taskkill /im chrome.exe /f
    
    On macOS/Linux, use:
    pkill chrome
    
    Note: This terminates all instances of the specified browser, so use it only when other methods fail.

2. Fixing Failed Transactions Caused by New Browser Instances During Playback

When new browser instances break your script's transaction flow, try these fixes:

  • Auto-switch to the new window: Before the action that triggers the new window (like clicking a _blank link), add a Set Window step and set it to New Window. TruClient will automatically detect and switch to the newly opened window, letting your transactions continue in the correct context.
  • Close the new window and revert: If you don't need the new instance, immediately follow the window-opening action with a Close Browser step targeting the new window (use its title/URL to identify it). Then add another Set Window step to switch back to your original browser window, so subsequent transactions can resume smoothly.
  • Enable instance reuse in settings: Check your TruClient script's Browser configuration. Look for an option like Reuse existing browser instance and enable it—this prevents TruClient from spawning new instances for every window trigger when possible.
  • Modify the trigger action: If the new instance comes from a link with target="_blank", edit the Click step's properties. Set the Open in new window option to No, forcing the link to open in your current window instead of a new one.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.13 09:10:50