I am using descriptive programming in UFT. During playback, I want to check if the Windows print dialog does appear. Then I want to click the Cancel button in that dialog. My problem: Sporadically QTP fails to identify the printing dialog, so clicking on the cancel button fails. How can this possibly sometimes fail, sometimes succeed?
My code syntax given below:
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
}