The Browser/loadAndDisplayImage extension loads an image from a URL and displays it on the current web page from inside a Virtuoso journey.
This is useful when your test needs to open or visually display an image using an image URL during journey execution.
Parameters:
-
imageLinkrequired, the full image URL to load and display. The URL must start withhttp,https, orftp.
Note: The extension validates the URL format before trying to load the image. If the URL is invalid, it throws an Error: Invalid URL provided. error.
NLP usage
Use the extension in a journey by calling Browser/loadAndDisplayImage with the execute command. Pass the image URL to the matching extension input using as imageLink.
Note: When the image loads successfully, it is appended to the current page body. If the image cannot be loaded, the page body is replaced with an error message.
To load and display an image from a URL:
execute "Browser/loadAndDisplayImage" using "https://example.com/image.png" as imageLinkYou can also use a Virtuoso variable to make the same step reusable for different image URLs:
execute "Browser/loadAndDisplayImage" using "$imageUrl" as imageLinkExample setup using a variable before calling the extension:
store value "https://example.com/image.png" in $imageUrl
execute "Browser/loadAndDisplayImage" using "$imageUrl" as imageLinkFor example, if the image loads successfully, the extension appends the image to the current page using the browser's Image object.
This extension does not require any external resource.
The extension should be configured as:
- Run asynchronously: No
- Scope: Global
Limitation: This extension depends on the browser being able to access and load the image URL. If the image server blocks access, requires authentication, or has CORS/security restrictions, the image may fail to load.
Add the extension to your Virtuoso instance
Select the domain that matches your Virtuoso account.
View source
Last updated: 22/05/2026
Resources: None
function viewImage(imageUrl) {
const isValidUrl = /^(ftp|http|https):\/\/[^ "]+$/.test(imageUrl);
if (!isValidUrl) {
throw new Error('Error: Invalid URL provided.');
}
const imageView = new Image();
imageView.addEventListener('load', function() {
document.body.appendChild(imageView);
});
imageView.addEventListener('error', function() {
document.body.innerHTML = '<h1>Error: Image not found or invalid URL.</h1>';
});
imageView.src = imageUrl;
}
const imageUrl = imageLink;
try {
viewImage(imageUrl);
} catch (error) {
console.error(error.message);
}
Comments
0 comments
Please sign in to leave a comment.