We can easily close a browser tab using Studio Pro activities. In this article, we describe the steps you can use to do that with web automation.
To use this method, you just need the Send hotkey activity to trigger the close window tab function in the browser.
Precondition: You need a browser window with more than one tab opened.
Follow these steps:
1. Add the Send hotkey activity
In this example, we want to close the wikipedia.com browser tab. So you must set the activity to work on a Wikipedia element, as the following image shows:
2. Configure the activity as shown in the image above
- Interface element: Select the Wikipedia element. You can also use the “Focused element” if the browser would be the current focus during the bot’s execution
- Key modifier: Ctrl is checked
- Key: W
If you want to close another tab, you just need to modify the Interface Element — or use the Activate element activity on the browser window, then use the "Focused element" option.
Note: Ctrl + W is the standard hotkey to close a browser tab.