How to Close the Tab in browser
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to Close the Tab in browser
I am working on the web applications and i know how to close whole window but not th eperticular tab.
For Browser:
Set Browser=Aliases.Browser
Browser.BrowserWindow.Close.
For Tab: ???????
Please Help...
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Browser.BrowserWindow(0).Keys("^[F4]")
''-Praise the sun and Give Kudos.''
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ctrl+F4, as in Ryan's solution, closes an active tab. To close another (inactive) tab you can use:
Aliases.Browser.MyPage.Close ' or Aliases.Browser.Page("http://example.com").Close
Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a similar issue. I need to close a tab in IE 11 that contains a PDF doc. As you know IE tabs sometimes behave differently. I tried to apply a VBScript Routine:
function CloseIETabWithCaption(Caption)
dim tabs, tmpTab, found, windowCaption
tabs = Aliases.browser.BrowserWindow.commandbar.tabband.ChildCount
for i=1 to tabs-1
Aliases.browser.BrowserWindow.commandbar.tabband.Child(i).WaitProperty Exists,true,1000
windowCaption = Aliases.browser.BrowserWindow.WndCaption
found = aqObject.CompareProperty(windowCaption, cmpContains, Caption)
if found then
Aliases.browser.BrowserWindow.commandbar.tabband.Child(i).Close()
end if
next
end function
However sometimes the code closes a wrong tab.
And if I open this PDF in more than one tab, it closes only one.
Please help me with a better solution for this issue.
