UFT not identifying a window in some playback

一个人想着一个人 提交于 2019-12-24 17:23:15

问题


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 
} 

回答1:


Your issue may be related to you storing references to objects before you have navigated to the page on which they exist.

Instead, after clicking on the button that opens the Print dialog try something like this (remembering to put in the relevant object identifiers):

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



回答2:


I found out the root cause of this problem, Actually am running the whole script in a Virtual Machine(VM). During some playback i minimize the VM and work on local system, so during minimizing UFT fails to detect the winobject and also there wont work the (send keys) any keypress events in minimized mode. We can solve the minimize issue by updating the registry edit. For more details go to:- can we execute QTP script on remote machine by keeping session minimized




回答3:


I solved issue like this, Rather than clicking on cancel button on that window i called close property dialog_Print.Activate dialog_Print.Close This works fine, but still i cant understand why UFT not identifying that window for some playbacks??

And absolute click function is only doing this: AbsoluteClick(Object) { object.Refreshobject object.Click }

and am using this for click in order to avoid another issue of UFT



来源:https://stackoverflow.com/questions/19075725/uft-not-identifying-a-window-in-some-playback

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!