【问题标题】:UFT not identifying a window in some playbackUFT 在某些播放中未识别窗口
【发布时间】:2013-09-29 07:53:58
【问题描述】:

我在 UFT 中使用描述性编程。在播放过程中,我想检查是否出现了 Windows 打印对话框。然后我想单击该对话框中的取消按钮。 我的问题:偶尔 QTP 无法识别打印对话框,因此单击取消按钮失败。 这怎么可能有时失败,有时成功?

我的代码语法如下:

Set Window_EnterMeter = browser_servicemanager.Window("regexpwndtitle:=Enter Meters.*") 
Set dialog_Print = Window_EnterMeter.Dialog("regexpwndtitle:=Print") 
Set winbtn_CalcelPrint = dialog_Print.WinButton("regexpwndtitle:=Cancel") 

fn chckprintpopupwndow() 
{ ''''''''Navigating to that page 
          call Absolutehighlight(Button_Action) 
          call Absolutehighlight(Meter_Entry) 
          call Absolutehighlight(PrintMeter_Opt2) 
          AbsoluteClick(PrintMeter_Opt2) 
          EnterMeters_Window.WebElement("html id:=ctl00_Save_BTN_C").Click 

'''''''By click on abve option window popup print option appears and UFT not identifying that window all times, so clicking on cancel button not doing so TC fails 
          dialog_Print.Activate 
          AbsoluteClick(winbtn_CalcelPrint) 
          EnterMeters_Window.WebElement("html id:=ctl00_Cancel_BTN_C").Click 
} 

【问题讨论】:

  • 你在那里做了一些奇怪的事情,但是我不知道你的 AUT。对象存储库并不完全是邪恶的——你有什么不能使用它的原因吗?在处理完全可点击的 WinButtons 时,你真的需要 AbsoluteClick 之类的东西(不管它可能做什么)吗?
  • 另外,fn chckprintpopupwindow() {} 不是 VBScript/UFT 语法。那么你实际在哪里运行这段代码呢?
  • fn { .. } 结构是什么语法?多年来,我是否错过了一些奇异的 VBS 语法属性?

标签: testing vbscript automation qtp hp-uft


【解决方案1】:

我找到了这个问题的根本原因,实际上是在虚拟机(VM)中运行整个脚本。在某些播放期间,我最小化 VM 并在本地系统上工作,因此在最小化 UFT 期间无法检测到 winobject,并且在最小化模式下也不会工作(发送键)任何按键事件。我们可以通过更新注册表编辑来解决最小化问题。欲了解更多详情,请访问:- can we execute QTP script on remote machine by keeping session minimized

【讨论】:

    【解决方案2】:

    您的问题可能与您在导航到对象所在的页面之前存储对对象的引用有关。

    相反,在单击打开打印对话框的按钮后尝试这样的操作(记得输入相关的对象标识符):

    Window().Dialog().Activate
    AbsoluteClick Window().Dialog().WinButton()
    Window().WebElement().Click
    

    【讨论】:

    • 或者,或者,使用 .RefreshObject 强制 QTP 在下一个重放步骤时重新识别测试对象。
    【解决方案3】:

    我解决了这样的问题,而不是单击该窗口上的取消按钮,我调用了关闭属性 dialog_Print.Activate 对话框打印。关闭 这工作正常,但我仍然无法理解为什么 UFT 没有为某些播放识别该窗口??

    而绝对点击功能只是这样做: 绝对点击(对象) { 对象。刷新对象 对象。点击 }

    我使用它来点击以避免另一个 UFT 问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-23
      • 2017-12-08
      • 1970-01-01
      • 2015-08-13
      • 2018-10-08
      相关资源
      最近更新 更多