Micro Focus QTP (UFT) Forums
How to close one of the browsers during runtime? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to close one of the browsers during runtime? (/Thread-How-to-close-one-of-the-browsers-during-runtime)



How to close one of the browsers during runtime? - jinnah1978 - 02-21-2012

I am trying to write a note and save it in "yahoo note pad"

I logged in using my credentials. When click on Notepad. it opens another tab (notepad). I want to close thew previous tab. Tried several ways. Please help me with your invaluable suggestion


Code:
SystemUtil.Run("iexplore.exe"),"www.yahoo.com"
wait(3)
Browser("Micclass:=Browser").Page("Micclass:=page").WebElement("innertext:=Mail" , "html tag:=EM").Click
Browser("Micclass:=Browser").Page("Micclass:=page").WebEdit("html id:=username").Set "................@yahoo.com"
Browser("Micclass:=Browser").Page("Micclass:=page").WebEdit("html id:=passwd").SetSecure"..................."
Browser("Micclass:=Browser").Page("Micclass:=page").WebButton("html id:=.save").Click

Browser("Micclass:=Browser").Page("Micclass:=page").WebElement("innerhtml:=Notepad").Click

Two tabs in this stage.I want to close 1st one and work on current one(Notepad)


RE: How to close one of the browsers during runtime? - inborntester - 02-22-2012

Browser("CreationTime:=1").Close. Make sure the index of first tab. (You may get it from object repository).


RE: How to close one of the browsers during runtime? - jinnah1978 - 02-23-2012

Thank you buddy! You are great!