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

UFT运行时实现多任务:能否同时操作其他应用程序?

How to Interact with Other Apps While UFT Runs Tests on a Target Application

Absolutely, you can interact with other applications while UFT executes tests on your primary target app—this is totally doable with a few settings tweaks and scripting tricks. Here are the most practical approaches:

1. Disable UFT's Exclusive Run Mode

First, check if UFT is set to block other apps during testing. This is a common default setting that trips people up:

  • Open your UFT test, go to Test > Settings > Run tab.
  • Uncheck the box labeled "Disable other applications during run session".
  • Save the settings and re-run your test. This will let UFT run in the background while you (or your script) interact with other apps.

2. Use UFT's Desktop Object for Targeted Interactions

If you want your UFT script to automatically interact with another app mid-test, use UFT's Desktop object to identify and manipulate the external app's windows/controls. You can use descriptive programming if you don't have the app in your object repository:

' Example: Interact with Notepad while UFT runs on your main app
Set notepadWindow = Desktop.Window("title:=Untitled - Notepad", "nativeclass:=Notepad")
notepadWindow.Activate
notepadWindow.WinEdit("nativeclass:=Edit").Set "This is typed from UFT while another test runs!"

Just make sure UFT can recognize the external app's objects—you might need to enable the relevant add-ins (like the Windows Forms add-in) if the app uses specific controls.

3. Leverage VBScript's WScript.Shell for Quick Actions

For simpler tasks (like activating a window, sending keystrokes, or launching an app), use the WScript.Shell object. This works even if UFT can't recognize the external app's UI elements:

Set objShell = CreateObject("WScript.Shell")
' Activate an existing window by title
objShell.AppActivate "Calculator"
' Send a keystroke combination (e.g., press 5 + 3)
objShell.SendKeys "5{+}3~"
' Launch a new app
objShell.Run "notepad.exe"

This is great for lightweight interactions that don't require deep UI control.

Key Notes

  • Synchronization: Always add waits (like WaitWindow or WaitProperty) when interacting with external apps to avoid timing issues. For example:
    Desktop.Window("title:=Calculator").WaitProperty("visible", True, 10000)
    
  • Add-ins: If UFT can't recognize the external app's controls, ensure you've loaded the appropriate add-ins (e.g., Web add-in for browsers, Java add-in for Java apps) before running the test.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.22 10:05:53