首页 文章

是否可以在UFT上以编程方式禁用“显示隐藏模式通知工具提示”?

提问于
浏览
2

我正在尝试在我的应用程序中运行一些自动化测试,但是UFT隐藏模式通知工具提示正在屏幕中的对象前面,阻止我的测试运行 .
我知道我可以取消选中远程代理设置中的选项"Display hidden-mode notification tooltip"以解决此问题,并且在我执行此操作后它在我的计算机上正常工作,但这些测试在其他计算机上执行,我公司的其他用户也会执行真正努力告诉他们每个人都要在他们的机器上更改此设置 .
这是一种禁用此程序复选框的方法吗?

EDIT:
以下是关于这对我影响的更多细节:
我正在测试一个Web应用程序,在我的一些测试用例中,我需要从这个应用程序下载一个文件 . 我通过单击上下文菜单中的"Save As"来执行此操作,该菜单显示在浏览器底部的通知栏上 . 以下是执行此类操作的代码部分:

Dim brwBottom
Set brwBottom = Browser("brw_Bottom_Save_As")

If brwBottom.WinObject("wo_Notification").WinButton("wb_Selector").Exist Then
    brwBottom.WinObject("wo_Notification").WinButton("wb_Selector").Click
    brwBottom.WinMenu("wm_Selector").Select "Save As"
End If

这在我的机器上正常工作,因为没有显示UFT通知,但在显示UFT通知 is 的其他机器中,它与菜单重叠,我的脚本无法选择"Save As"选项 . 因此,如果无法在运行时以编程方式关闭此通知,是否有任何替代解决方案可以单击"Save As"按钮,即使此通知与其重叠?

4 回答

  • 1

    我设法识别UFT通知工具提示并关闭它 . 有了这个,我需要点击按钮前面没有更多的对象,我的脚本可以成功执行 . 以下是使用的代码 . 我并没有将此标记为可接受的答案,因为我仍在等待我的团队接受解决方案,但这有效 .

    Dim brwBottom
    Set brwBottom = Browser("brw_Bottom_Save_As")
    
    ' To close UFT Notification Tooltip, if exists
    If Window("regexpwndtitle:=NotificationWindow").Exist(2) Then
        If InStr(Window("regexpwndtitle:=NotificationWindow").GetROProperty("nativeclass"),"UFTRemoteAgent") > 0 Then
            Window("regexpwndtitle:=NotificationWindow").Close
        End If
    End If
    
    If brwBottom.WinObject("wo_Notification").WinButton("wb_Selector").Exist Then
        brwBottom.WinObject("wo_Notification").WinButton("wb_Selector").Click
        brwBottom.WinMenu("wm_Selector").Select "Save As"
    End If
    
  • 0

    我完全理解你的痛苦,因为我的项目还需要与IE下载栏进行交互 . 通常,我使用 SendKeys 来处理不同项目中的下载活动 .

    当下载栏出来时,你可以先发送 ALT+N 设置焦点在下载栏上,然后发送一些标签键在 Save 上选择,有些 Down Arrow 键选择 SaveAs .

    通过这种方式,您无需费心处理UFT通知......

    样本 SendKeys 代码可以很容易地用Google搜索 .

  • 1

    创建UFT GUI测试并包含以下三行:

    extern.Declare micLong, "WritePrivateProfileString", "kernel32.dll", "WritePrivateProfileString", micString, micString, micString, micString
    extern.WritePrivateProfileString "RemoteAgent", "ShowBallon", "0", Environment("ProductDir") + "\bin\mic.ini"
    systemutil.CloseProcessByName "UFTRemoteAgent.exe"
    

    从ALM,在所有UFT计算机上运行它 .

    Notes:

    • 这会将控制此类工具提示的标志切换为关闭,因此下次Remote Agent启动时会读取它并且不再显示工具提示 .

    • 第三行将终止UFT 's remote agent for GUI testing which is in charge of the communication between UFT and ALM Client and this will cause an error in ALM'的自动运行器(RPC服务器不可用)...只是忽略它 . 我们需要杀死它,以便下次我们尝试从ALM运行测试时重新启动它(如上所述,将读取工具提示的新值)

    EDIT:

    我发现了一些有趣的东西:这个标志实际上保存在两个位置:

    • mic.ini

    • RemoteAgentGUISettings.xml

    但实际上使更改有效的是RemoteAgentGUISettings.xml(似乎他们正在从.ini文件切换到.xml ......这很有意义) . 在这种情况下,代码会稍微改变一下,但想法是一样的:

    filePath = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%appdata%") + "\Hewlett-Packard\UFT\Persistence\Dialogs\RemoteAgentGUISettings.xml"
    Set xmlDoc = CreateObject("Microsoft.XMLDOM")
    xmlDoc.load filePath
    Set nNode = xmlDoc.selectsinglenode ("//SettingsViewModel/IsShowBalloon")
    nNode.text = "false"
    strResult = xmldoc.save(filePath)
    systemutil.CloseProcessByName "UFTRemoteAgent.exe"
    

    这次我确定它有效;)

  • 2

    您可以使用以下方法激活所需的浏览器,然后尝试执行另存为

    hwnd = Browser("title:=.*").GetROProperty("hwnd")
    Window("hwnd:=" & hwnd).Activate
    

相关问题