Skip to main content

SeeTestAutomation- getCurrentBrowserTabId, getBrowserTabIdList and switchToBrowserTab

info

Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .

Supports: Google Chrome (Android) \ iOS Safari

info

The following commands allow users to change the current Javascript execution context of a mobile web browser, the tab with the current JS execution context is referred to as focused \ active tab

warning

Switching tabs will not display on the browser the tab with the ID that you wanted to switch to, but will only change the JS Execution context

getCurrentBrowserTab - returns the internal browser ID of the active (focused)

getBroswerTabIdList - returns a List of all opened tab id's

switchToBrowserTab - Switches JS execution context to the ID provided

Examples - working with browser tabs

		String currentId = client.getCurrentBrowserTabId(); 
List<String> tabs = Arrays.asList(client.getBrowserTabIdList());
for (String tabId : tabs)
{
client.switchToBrowserTab(tabId);
System.out.println(client.hybridRunJavascript("", 0, "result = document.URL")); // will print out all open tabs
}
client.switchToBrowserTab(currentId); // returns JS context to the original tab - which is displayed in the browser