Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to close a Window
#1
Not Solved
I have a web application and in that application there are links to open other windows.

I have a situation where QTP will click the link and open the window but will not click the Close button in the newly opened window to close it.

The Close Button (Link) is in the Object Repository and using the Opbject Repository Manager I can locate the Close Button (link) in the newly opened window and I can locate the Close Button (link) in the Object repository...

Here is the code I currently have that opens the window by clicking on the View link and then to close the window by clicking the Close Button (link) in the window to close it and then it repeats for another link...

Code:
Browser("Access Provisioning Request").Page("Confirm Application Access").Link("View").Click
Browser("Additional Windows").Page("APRS : VIEW APPLICATION").Link("Close").Click
Browser("Access Provisioning Request").Page("Confirm Application Access").Link("View_2").Click
Browser("Additional Windows").Page("APRS : VIEW APPLICATION").Link("Close").Click
Help...I do not understand why this window is not closing..
Reply
#2
Not Solved
Hi,

Since this is a web application and page needs time to load use sync function to first let the page opens properly and then try to close the page, it should help u.

Regards,
Sankalp
Reply
#3
Not Solved
Sankalp

Thanks for the reply...a little refresher what is sync function?

Sankalp

I tried the Sync....but it still does not close the window....any other suggestions?
Reply
#4
Not Solved
please try the following

Code:
Browser("Access Provisioning Request").Page("Confirm Application Access").Link("View").Click
Browser("Additional Windows").Page("APRS : VIEW APPLICATION").Link("Close").Click
Browser("Access Provisioning Request").Page("Confirm Application Access").Link("View_2").Click
' ####added script From ###
Browser("Access Provisioning Request").Page("Confirm Application Access").RefreshObject
' ####added script End ###
Browser("Additional Windows").Page("APRS : VIEW APPLICATION").Link("Close").Click
[hr]
Please try the following

Code:
Browser("Access Provisioning Request").Page("Confirm Application Access").Link("View").Click
Browser("Additional Windows").Page("APRS : VIEW APPLICATION").Link("Close").Click
Browser("Access Provisioning Request").Page("Confirm Application Access").Link("View_2").Click
' ####added script From ###
'Browser("Additional Windows").RefreshObject
'Browser("Additional Windows").Page("APRS : VIEW APPLICATION").RefreshObject
Browser("Additional Windows").Page("APRS : VIEW APPLICATION").Link("Close").RefreshObject
' ####added script End ###
Browser("Additional Windows").Page("APRS : VIEW APPLICATION").Link("Close").Click
Reply
#5
Not Solved
one alternate suggestion would be to

Code:
Browser("Additional Windows").Page("APRS : VIEW APPLICATION").Close
Reply
#6
Not Solved
Try This it worked for me

Code:
hWnd = Browser(BrowserName).GetROProperty("hwnd")      
hWnd = Browser("hwnd:=" &hWnd).Object.hWnd                                  
Window("hwnd:=" & hWnd).Activate  
Browser("hwnd:=" & hWnd).Close
Reply
#7
Not Solved
Please ensure to include your code between [code] tags while asking or replying to questions. I have done this for you for this time.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)