Perform browser action
The Browser/performBrowserAction extension performs common browser navigation actions from inside a Virtuoso journey.
This is useful when your test needs to go back, go forward, reload the page, capture the current URL, navigate to another URL, replace the current URL, or check the referrer URL.
Parameters:
-
actionrequired, the browser action to perform. Supported values includeback,forward,reload,current,navigate,replace,referrer, andblank; -
urloptional for most actions, but required fornavigate,replace, andblank.
Note: The extension also supports aliases. Use previous for back, next for forward, and refresh for reload.
NLP usage
Use the extension in a journey by calling Browser/performBrowserAction with the execute command. Pass each value to the matching extension input using as inputName.
Note: Actions such as back, forward, and reload may change the current page immediately. Use them only when the journey is ready for navigation.
To return the current browser URL:
execute "Browser/performBrowserAction" using "current" as action, "" as url returning $statusTo navigate back in the browser history:
execute "Browser/performBrowserAction" using "back" as action, "" as url returning $statusTo navigate forward using the alias value:
execute "Browser/performBrowserAction" using "next" as action, "" as url returning $statusTo navigate to a specific URL:
execute "Browser/performBrowserAction" using "navigate" as action, "https://rocketshop.virtuoso.qa" as url returning $statusYou can also use Virtuoso variables to make the same step reusable across different browser actions or target URLs:
execute "Browser/performBrowserAction" using "$browserAction" as action, "$targetUrl" as url returning $statusExample setup using variables before calling the extension:
store value "navigate" in $browserAction
store value "https://rocketshop.virtuoso.qa" in $targetUrl
execute "Browser/performBrowserAction" using "$browserAction" as action, "$targetUrl" as url returning $statusFor example, the current action returns the current browser URL as text:
Current URL: https://example.com/pageThis extension does not require any external resource.
The extension should be configured as:
- Run asynchronously: No
- Scope: Global
Limitation: This extension relies on browser APIs such as window.history, window.location, and document.referrer. Navigation actions may interrupt the current page state, so use them carefully in the journey flow.
Add the extension to your Virtuoso instance
Select the domain that matches your Virtuoso account.
View source
Last updated: 22/05/2026
Resources: None
// Define navigation functions
const navigationActions = {
back: () => {
window.history.back();
return "Navigated back.";
},
forward: () => {
window.history.forward();
return "Navigated forward.";
},
reload: () => {
window.location.reload();
return "Page reloaded.";
},
current: () => `Current URL: ${window.location.href}`,
navigate: (url) => {
if (url) {
window.location.href = url;
return `Navigated to ${url}.`;
} else {
return "Error: URL is required for navigation.";
}
},
replace: (url) => {
if (url) {
window.location.replace(url);
return `URL replaced with ${url}.`;
} else {
return "Error: URL is required to replace the current URL.";
}
},
referrer: () => `Referrer URL: ${document.referrer}`,
blank: (url) => {
if (url) {
window.open('', '');
return `Opened a blank tab.`;
} else {
return "Error: URL is required to open in a new tab.";
}
}
};
// Alias mappings for user-friendly commands
const aliasActions = {
previous: 'back',
next: 'forward',
refresh: 'reload'
};
// Perform browser action based on input
function performBrowserAction(action, url) {
action = action.toLowerCase();
// Resolve action alias if any
action = aliasActions[action] || action;
// Get the corresponding navigation function
const navigationAction = navigationActions[action];
// Execute the navigation function if it exists
if (navigationAction) {
return navigationAction(url);
} else {
return `Error: Unknown action "${action}".`;
}
}
return (performBrowserAction(action,url));
Comments
0 comments
Please sign in to leave a comment.