Closing a specific tab in IE with UFT
Question ID: 105667
1
0

I have a test that opens multiple website in tabs in IE. How can I close a specific tab and leave the other ones open?

Marked as spam
Posted by (Questions: 387, Answers: 66)
Asked on October 28, 2014 2:59 pm
1414 views
Answers (1)
1
Private answer

The following code will take a browser that is open to Google.com and open a new tab, then nagivate to eyeontesting.com on the new tab, then will close just the google.com tab. Modify for your needs...

'Browser is open to Google.com

Browser(''Google'').Page(''Google'').WebEdit(''q'').Set ''eyeontesting''

Browser(''Google'').Page(''orasi - Google Search'').WebButton(''btnG'').Click

Browser(''Google'').OpenNewTab

Browser(''Browser'').Page(''Page'').Sync

Browser(''Browser'').Navigate ''eyeontesting.com''

CloseBrowserByTitle ''Google'', true

Sub CloseBrowserByTitle(title, isregex)

Set desc = Description.Create()

desc(''title'').Value = title

desc(''title'').RegularExpression = isregex

desc(''index'').Value = ''0''

While Browser(desc).Exist(5)

Browser(desc).Close

Wend

End Sub

Marked as spam
Posted by (Questions: 17, Answers: 807)
Answered on October 28, 2014 3:00 pm
0
That method worked great for us. Thanks!
( at October 28, 2014 3:01 pm)
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top