Web Browser - Close tab
Declaration
<AMWEBBROWSER ACTIVITY="closetab" SESSION="text" />
Description
Closes the currently active web browser tab in an established session.
IMPORTANT:
- This activity cannot close a tab that is requesting you to save or submit form data before continuing.
- If the browser only has one tab open, this activity closes the browser but does not delete the Session variable from the Session list. To delete the Session variable, use the Web Browser - Close activity instead.
NOTE:
- The Web Browser action is not backwards compatible with the Web Browser (Legacy) action.
- This activity is compatible with Chrome, Edge, and Firefox browsers only – Internet Explorer is not supported.
- The browser you specify must be updated to the latest version and installed on the target system to ensure the Web Browser action functions correctly.
- Unlike other session-based actions where sessions are optional, the use of a session in the Web Browser action is required as each created session explicitly links to a specific web browser instance. A session is created using the Web Browser - Create session or Web Browser - Open activity. Numerous sessions are supported within a single task, however, since Web Browser actions are performed interactively (and not in the background), each session must run concurrently to avoid sending interactions to the wrong browser window.
Practical usage
See Description.
Parameters
Browser
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Session name | Text | Yes | BrowserSession1 | SESSION="mySession" | Specifies the name of an existing session to associate with this activity. Numerous sessions can exist within a single task allowing activities to be performed on several web browsers simultaneously. NOTE:
|
Example
NOTE:
- Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
- To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.
Description
This sample task opens the Edge browser to https://www.fortra.com, opens a new tab to https://www.fortra.com/product-lines/automate, switches back to the tab containing https://www.fortra.com and then closes it.
Copy
<AMWEBBROWSER URL="https://www.fortra.com" BROWSER="edge" SESSION="BrowserSession1" />
<AMWEBBROWSER ACTIVITY="newtab" SESSION="BrowserSession1" URL="https://www.fortra.com/product-lines/automate" />
<AMWEBBROWSER ACTIVITY="switchtab" SESSION="BrowserSession1" SEARCHBY="domain" VALUE="https://www.fortra.com" />
<AMWEBBROWSER ACTIVITY="closetab" SESSION="BrowserSession1" />