Close Tab (browser)

Hi! In try catch:
Try: check mail on
certain message
Catch: close tab(chrome)

But I have error:
Try Catch: Cannot find the UI element corresponding to this selector:
Why?

Hi @RPA3

Can you fine tune the selector and check or use send hot key activity as Ctrl+W to close the tab

Thanks
Ashwin S

1 Like

Hi
instead of Close Tab use KILL PROCESS activity and mention as “chrome” in ProcessName in the property panel

Cheers @RPA3

4 Likes

Use the attach browser activity and inside that use close tab activity, use browser variable which you get from the output of the attach browser as input to close tab and check…

2 Likes

I don’t know why, but I tried all the ways, none worked for me

Check with this workflow,
Test_Sequence.xaml (4.8 KB)
And change, select the browser type as you need.

1 Like

So it works for me, but in try catch not

are we running in debug mode kindly run in normal mode and check once pls
@RPA3

Can you tell me in brief , what are you doing in try and catch section??

Try: check mail on
certain message
Catch: close tab(chrome)

But I have error:
Try Catch: Cannot find the UI element corresponding to this selector:

Hi
is that TRY CATCH is placed inside a attach browser or attach window activity
@RPA3

Inside the catch use, attach browser and close tab.
Its working for me, it should work to you also.
And check whether your try section throws any error or not.

1 Like

Can you attach an example? I have open Browser

Could you help me, please ??

Have you tried the “UiPath.Core.Activities.CloseTab” ?

Both are different activity and working of both activity is different. So this is not a right way to use kill Process in place of close tab.
Kill Process close all chrome tabs but Close tab close particular tab or window.

I tried this but it closed the first tab instead of the current tab (which was the second tab). I solved it by clicking the right tab with middle mouse button.