Facebook

For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
New Schedule in MindQ Systems, Madhapur By SUDHAKAR
Course Name Date Time Duration Type Branch
UFT + UFTPro 20th September 2017 7.30 AM - 9.00 AM IST 25Days Classroom + Online Hitech City
Selenium+Appium 4th October 2017 4.30 PM - 6.00 PM IST 40Days Online -

A book "Cracking the QTP interview" authored by Sudhakar.Read More. Buy From FlipKart

Friday, October 9, 2009

Close latest opened Browser using QTP

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

8 comments :

  1. This a very good solution you provided. Thank you very much.

    ReplyDelete
  2. Excellent! Thanks you very much Sudhakar

    ReplyDelete
  3. Superb Code.... Thankyou very much.

    ReplyDelete
  4. I 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.

    ReplyDelete
  5. Use below code. It will open and close the current browser.

    set ie = createobject("internetexplorer.application")
    ie.visible = true
    ie.navigate "URL"

    'Perform your task

    ie.quit
    set ie = nothing

    ReplyDelete
  6. 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...

    ReplyDelete