Internet Explorer
(Available from version 7.2 onwards.)
The Internet Explorer built-in service provides functions and events for controlling and monitoring tabs in Internet Explorer.
The Generic HTML Browser built-in service provides similar functionality for other browsers, including Chrome, Firefox, and Microsoft Edge.
If multiple instances of Internet Explorer are open, each with one or more tabs open, the Internet Explorer functions will treat all open tabs as if they were open in the same, single instance of Internet Explorer. Specific details are provided below for each function, but in general:
-
Where a function relates to the active tab, it will relate to the active tab in the instance of Internet Explorer that was activated most recently.
-
Where a function relates to tabs by ID, it will relate to the tabs irrespective of which instance of Internet Explorer they are open in as the tab IDs are unique across instances.
-
Tab index numbers are counted from the left-most tab in the instance of Internet Explorer that was activated most recently.
Functions
An individual example is provided for each function described in this topic.
Project Download
Download the project here and unzip to the folder to any location, for example, the Automation Stuio Projects folder at %AppData%/Nice_Systems/AutomationStudio/Projects\.
This project includes all the workflows shown in the examples. The workflows are named with the name of the function demonstrated.
Activates a browser tab specified by title. Wildcards * (multiple characters) and ? (single character) are supported.
Specify an index (1-based) to specify which tab to open if multiple tabs have titles that match the title specified.
Tabs that are not visible without scrolling cannot be activated.
If multiple instances of Internet Explorer are open, tab index 1 refers to the first tab in the instance of Internet Explorer that was activated most recently.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
tab title |
text |
The title of the tab |
index |
number |
The index (1-based) of the tab to open if multiple tabs share the same title |
Returns
Returns a Boolean value of true if the tab was activated
Example
Three tabs are open:
-
https://www.nice.com/
-
https://www.nice.com/
-
https://www.google.com (active)
To activate the 2nd tab, use Activate Tab by Title, setting tab title to *NICE* (using wildcards as the title includes additional text) and index to 2:
The middle tab is now activated:
The variable Boolean_A is set to true, indicating that the tab was activated successfully:
Setting tab title to Enabling* would have the same result in this example.
Activates the browser tab specified by URL and index.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
URL |
text |
The URL of the tab to close. Wildcards * (multiple characters) and ? (single character) are supported. |
Index | number | If multiple tabs are open to the specified URL, specifies the index of the tab to close. The first tab has an index number of 1. |
Returns
Returns Boolean value true if successful, or false if unsuccessful.
Example
The workflow below activates the 2nd tab that is open to any site that includes nice in the URL.
Four tabs are open, three of which are open to the NICE home page.
When the workflow is run, the 2nd tab that is open to the NICE home page is activated.
Closes the active browser tab.
Parameters
No parameters
Returns
Nothing
Example
This example closes the active tab.
Before running the workflow, three tabs are open. The middle tab is active.
After the workflow is run, only two tabs are open - the tab that was active was closed.
Close all tabs specified by title.
Wildcards * (multiple characters) and ? (single character) are supported.
If multiple instances of Internet Explorer are open, tabs with titles that match the specified title will be closed in all instances of Internet Explorer.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
tab title |
text |
The title of the tab |
Returns
Nothing
Example
Three tabs are open:
-
https://www.nice.com/
-
https://www.nice.com/
-
https://www.google.com (active)
To close both https://www.nice.com/ tabs, use Close All Tabs by Title, setting tab title to *NICE* (using wildcards as the title includes additional text):
Both tabs to https://www.nice.com/ were closed:
Setting tab title to Enabling* would have the same result in this example.
Closes a browser tab specified by its ID.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
tab ID |
number |
The ID of the tab |
Returns
Nothing
Example
Three tabs are open:
-
https://www.nice.com/
-
https://www.nice.com/
-
https://www.google.com (active)
This example first retrieves a list of tab IDs of all tabs that have the URL https:/www.nice.com/ using the workflow in the example for Get Tab ID by URL, and then closes each one in turn using Close Tab by ID:
Both tabs to https://www.nice.com/ were closed:
Runs a specified Javascript on a tab specified by ID and returns the value of a specified global variable.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
tab ID |
number |
The ID of the tab |
Javascript |
text |
The Javascript to run |
global variable name |
text |
The global variable to return |
Returns
Returns the value of the specified global variable as text
Example
This example executes the simple Javascript below in the active tab. The Javascript sets the value of a global variable called retVal to the current year.
var today = new Date(); var retVal = today.getFullYear();
The value of retVal is then stored in the text variable text_var_a.
The value of text_var_a is set to the current year, 2020, as expected:
Runs a specified Javascript on a tab specified by ID.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
tab ID |
number |
The ID of the tab |
Javascript |
text |
The Javascript to run |
Returns
Nothing
Example
This example executes the Javascript below to display a simple message on the active tab:
alert('Hello World');
The script is run on the active tab:
Retrieves the IDs of tabs specified by title.
Wildcards * (multiple characters) and ? (single character) are supported.
If multiple tabs match the specified title, the IDs will be returned for all of them.
If multiple instances of Internet Explorer are open, the IDs will be returned for all matching tabs in all instances of Internet Explorer.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
tab title |
text |
The title of the tab |
Returns
Returns the IDs of the tabs in a list of numbers
Example
Three tabs are open:
-
https://www.nice.com/
-
https://www.nice.com/
-
https://www.google.com (active)
To retrieve a list of IDs of both https://www.nice.com/ tabs, use Get All Tab IDs by Title, setting tab title to *NICE*, and assign the value to a list of numbers (list_of_IDs_by_title):
In debug mode, the variable list_of_IDs_by_title includes 2 elements as expected, each containing the ID of one of the https://www.nice.com/ tabs:
Setting tab title to Encoding* would have the same result in this example.
Retrieves the IDs of tabs specified by URL.
Wildcards * (multiple characters) and ? (single character) are supported.
If multiple tabs match the specified URL, the IDs will be returned for all of them.
If specified without wildcards, the tab URL must exactly match the URL in the browser. For example, if the browser tab URL is set to https://www.nice.com/, neither www.nice.com nor https://www.nice.com will be recognized.
If multiple instances of Internet Explorer are open, the IDs will be returned for all matching tabs in all instances of Internet Explorer.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
tab URL |
text |
The URL of the tab |
Returns
Returns the IDs of the tabs in a list of numbers
Example
Three tabs are open:
-
https://www.nice.com/
-
https://www.nice.com/
-
https://www.google.com (active)
To retrieve a list of IDs of both https://www.nice.com/ tabs, use Get All Tab IDs by URL, setting tab URL to https://www.nice.com/, and assign the value to a list of numbers (list_of_IDs_by_URL):
In debug mode, the variable list_of_IDs_by_URL includes 2 elements as expected, each containing the ID of one of the https://www.nice.com/ tabs:
Setting tab URL to *www.nice.com* would have the same result in this example.
Retrieves the ID and title of each open tab in a list of key-value pairs.
Parameters
No parameters
Returns
Returns a list of type key-value pair. In each pair, the Key parameter stores the ID of a tab and the Value parameter stores its title.
Example
This workflow populates the key-pair list List_of_Tabs with details of all tabs open in Internet Explorer.
Three tabs are open in Internet Explorer.
When the workflow is run, the list List_of_Tabs is populated with the ID and title of each tab.
Retrieves the ID of the tab specified by title.
Wildcards * (multiple characters) and ? (single character) are supported.
If multiple tabs match the specified title, the ID will be returned for the first matching tab to the right of the active tab (or of the active tab itself).
If multiple instances of Internet Explorer are open, the ID will be returned for the first matching tab to the right of the active tab (or of the active tab itself) in the instance of Internet Explorer that was activated most recently.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
tab title |
text |
The title of the tab |
Returns
Returns the ID of the first tab with matching title as a number
Example
Three tabs are open:
-
https://www.nice.com/
-
https://www.nice.com/
-
https://www.google.com (active)
To retrieve the ID of the first tab to https://www.nice.com, use Get Tab ID by Title, set tab title to *NICE*, and assign the output to a number variable (tab_ID_by_title):
In debug, the variable tab_ID_by_title is set to the ID of the first tab to https://www.nice.com/:
Setting tab title to Enabling* would have the same result in this example.
Retrieves the ID of the tab specified by URL.
Wildcards * (multiple characters) and ? (single character) are supported.
If multiple tabs match the specified URL, the ID will be returned for the first matching tab to the right of the active tab (or of the active tab itself).
If specified without wildcards, the tab URL must exactly match the URL in the browser. For example, if the browser tab URL is set to https://www.nice.com/, neither www.nice.com nor https://www.nice.com will be recognized.
If multiple instances of Internet Explorer are open, the ID will be returned for the first matching tab to the right of the active tab (or of the active tab itself) in the instance of Internet Explorer that was activated most recently.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
tab URL |
text |
The URL of the tab |
Returns
Returns the ID of the active tab as a number
Example
Three tabs are open:
-
https://www.nice.com/
-
https://www.nice.com/
-
https://www.google.com (active)
To retrieve the ID of the first tab to https://www.nice.com, use Get Tab ID by URL, set tab URL to https://www.nice.com/, and assign the output to a number variable (tab_ID_by_URL):
In debug, the variable tab_ID_by_URL is set to the ID of the first tab to https://www.nice.com/:
Retrieves the ID of the active tab.
If multiple instances of Internet Explorer are open, the ID of the active tab in the instance of Internet Explorer that was activated most recently will be returned.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
None |
Returns
Returns the ID of the active tab as a number
Example
Three tabs are open:
-
https://www.nice.com/
-
https://www.nice.com/
-
https://www.google.com (active)
To retrieve the ID of the active tab (https://www.google.com), use Get Active Tab ID and assign the output to a number variable (active_tab_ID):
In debug, the variable active_tab_ID is set to the ID of the active tab:
Retrieves the title of a tab specified by ID.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
tab ID |
number |
The ID of the tab |
Returns
Returns the title of the tab as text.
Example
Three tabs are open:
-
https://www.nice.com/
-
https://www.nice.com/
-
https://www.google.com (active)
This example retrieves the ID of the active tab using Get Active Tab ID, retrieves the title of that tab using Get Tab Title by ID, and stores the title in the text variable tab_title_by_id:
In debug, the variable tab_title_by_id is set to the title of the active tab:
Retrieves the URL of a tab specified by ID.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
tab ID |
number |
The ID of the tab |
Returns
Returns the URL of the tab as text
Example
Three tabs are open:
-
https://www.nice.com/
-
https://www.nice.com/
-
https://www.google.com (active)
This example retrieves the ID of the active tab using Get Active Tab ID, retrieves the URL of that tab using Get Tab URL by ID, and stores the title in the text variable tab_URL_by_id:
In debug, the variable tab_URL_by_id is set to the URL of the active tab:
Indicates if Internet Explorer is running.
Parameters
No parameters
Returns
Returns Boolean value true if Internet Explorer is running.
Example
Three tabs are open:
-
https://www.nice.com/
-
https://www.nice.com/
-
https://www.google.com (active)
This example tests whether Internet Explorer is running. The variable Boolean_B is set to true if it is.
In debug, the variable Boolean_B is set to true as expected:
Navigates to the specified URL in the tab specified by ID. The tab is not activated automatically.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
URL |
text |
The URL to navigate to |
tab ID |
number |
The ID of the tab |
Returns
Nothing
Example
Three tabs are open:
-
https://www.nice.com/
-
https://www.nice.com/
-
https://www.google.com (active)
This example retrieves the ID of the active tab using Get Active Tab ID,and navigates to the site www.yahoo.com:
As the tab showing www.google.com was active, that tab now shows www.yahoo.com:
Navigates to the specified URL in a new tab of the active instance of Internet Explorer. The new tab is set to active.
A new instance of Internet Explorer is opened if no instance is open.
If multiple instances of Internet Explorer are open, the new tab will be opened in the Instance of Internet Explorer that was activated most recently.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
URL |
text |
The URL to navigate to |
Returns
Nothing
Example
Three tabs are open:
-
https://www.nice.com/
-
https://www.nice.com/
-
https://www.google.com (active)
This example opens www.yahoo.com in a new tab.
A new tab is added showing www.yahoo.com, and that tab is activated:
Navigates to the specified URL in a new instance of Internet Explorer.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
URL |
text |
The URL to navigate to |
Returns
Nothing
Example
In this example, a new instance of Internet Explorer is opened to www.bing.com:
A new Internet Explorer window is opened to the specified URL:
Reloads the active tab in the browser.
Parameters
No parameters
Returns
Nothing
Example
This example reloads the active tab.
The active tab is refreshed.
Reloads the tab specified by ID. The tab is not automatically made the active tab.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
tab ID |
number |
The ID of the tab |
Returns
Nothing
Example
This example retrieves the ID of the active tab using Get Active Tab ID, and refreshes that tab using Reload Tab by ID:
The active tab (showing www.google.com) is reloaded: