How to close google chrome browser tabs one by one at a time? (432 Views)
Reply
Advisor
pradeepsingh999
Posts: 35
Registered: ‎12-10-2012
Message 1 of 6 (432 Views)
Accepted Solution

How to close google chrome browser tabs one by one at a time?

Hi,

 

I have successfully close the IE browser and firefox browser tabs one by one (except first one)  but unable to do so with chrome browser.

 

'***********************************************************************************************
Function fnCloseTabExceptOne (browserPropertyApplicationVersion)

On error resume next

Set oDesc = Description.Create
oDesc( "micclass" ).Value = "Browser"

oDesc( "application version" ).Value = browserPropertyApplicationVersion

Set vIE= Desktop.ChildObjects(oDesc)
vIECount=vIE.count

z=vIECount
For m=1To vIECount - 1
z=z-1
    If Browser("creationtime:="&z).Exist(0) Then

            Browser("creationtime:=1").Close
   
    End If


If err.number > 0 Then
message = message & " @@@@@@@Error shown by application is :  " & err.description
icon_flag=0
End If
Next

Set oDesc = Nothing
Set vIE=Nothing
End Function

 

 

'***********************************************************************************************

 

 

 

Could anybody tell me how to achieve this for chrome browser also?

 

Thanks & Regards

Pradeep Singh

Please use plain text.
Frequent Advisor
pavanpy
Posts: 56
Registered: ‎04-11-2013
Message 2 of 6 (410 Views)

Re: How to close google chrome browser tabs one by one at a time?

You can try keyboard actions.

example: Browser("...").Type micCtrlDwn+micF4+micCtrlUp.

 

Switching between tabs can be done using Ctrl+Tab and Ctrl+Shift+Tab.

 

+pavan

 

Please use plain text.
Advisor
pradeepsingh999
Posts: 35
Registered: ‎12-10-2012
Message 3 of 6 (408 Views)

Re: How to close google chrome browser tabs one by one at a time?

Thankx Pavanpy,

 

I will try this solution suggested by you.

 

 

Thanks & Regards

Pradeep Singh

Please use plain text.
Advisor
pradeepsingh999
Posts: 35
Registered: ‎12-10-2012
Message 4 of 6 (398 Views)

Re: How to close google chrome browser tabs one by one at a time?

Hi,

 

The solution provide by you is not worked for me.  When I use below to close one tab then it close chrome browser completely instead of one tab.

 

objShell.Sendkeys "^{W}"

 

Please use plain text.
Frequent Advisor
pavanpy
Posts: 56
Registered: ‎04-11-2013
Message 5 of 6 (389 Views)

Re: How to close google chrome browser tabs one by one at a time?

Keyboard command to close individual tab on browser: Ctrl + F4

 

Keyboard command to close browser window: Alt + F4

 

Are you using the correct ones?

 

+pavan

Please use plain text.
Advisor
pradeepsingh999
Posts: 35
Registered: ‎12-10-2012
Message 6 of 6 (386 Views)

Re: How to close google chrome browser tabs one by one at a time?

Thanks Pavanpy,

 

Now it works for me.

 

 

Thanks once again....

Pradeep Singh

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation