Forum Discussion
- Ryan_MoranValued Contributor
Browser.BrowserWindow(0).Keys("^[F4]")
- HKosovaSmartBear Alumni (Retired)
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
- emaizlerNew Member
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 functionHowever 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.
Related Content
- 8 years ago
- 8 years ago
Recent Discussions
- 2 days ago