Close latest opened Browser using QTP
Dim pTitle
'*********************************************************
'Calling the Function
Call CloseLatestOpenedBrowser()
Function CloseLatestOpenedBrowser()
Dim oDescription
Dim BrowserObjectList
Dim oLatestBrowserIndex
Set oDescription=Description.Create
oDescription("micclass").value="Browser"
Set BrowserObjectList=Desktop.ChildObjects(oDescription)
oLatestBrowserIndex=BrowserObjectList.count-1
Browser("creationtime:="&oLatestBrowserIndex).close
Set oDescription=Nothing
Set BrowserObjectList=Nothing
End Function
'*********************************************************
____________________________________________________________
Please send your Suggestions and Doubts to my yahoo group http://in.groups.yahoo.com/group/qtpsudhakar
Good One :-)
ReplyDeleteThis a very good solution you provided. Thank you very much.
ReplyDeleteExcellent! Thanks you very much Sudhakar
ReplyDeleteSuperb Code.... Thankyou very much.
ReplyDeletethn buddy :)
ReplyDeleteI want to know what url my application has opened in Internet explorer. This is not working, if you would help that will be too gratefull.
ReplyDeleteUse below code. It will open and close the current browser.
ReplyDeleteset ie = createobject("internetexplorer.application")
ie.visible = true
ie.navigate "URL"
'Perform your task
ie.quit
set ie = nothing
excellent dude.. i have come across this question in interview.. same browser closing using function i need pass the browser creation time number as 3 and it should close the second browser..(using function) can u help me on this...
ReplyDeleteLife saver! thanks
ReplyDelete