我在 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
}