The $TS.screen()
function call is used to display the website act.com/fr-fr/produits/act-premium
with specific settings, including a 50% zoom level, 680-pixel width, and a 400x400 crop region.
$TS.screen('act.com/fr-fr/produits/act-premium', {zoom: .5, width: 680, 'crop-y': 400, 'crop-h': 400});
/**
* Navigates to the specified URL with custom browser settings.
*
* @param url The URL to navigate to.
* @param options Optional settings for the browser.
* @param options.zoom The zoom level for the browser.
* @param options.width The width of the browser window.
* @param options.cropY The y-coordinate for cropping the browser window.
* @param options.cropH The height of the cropped browser window.
*/
function navigateToUrlWithCustomSettings(url: string, options: NavigateToUrlOptions): void {
// Merge default settings with provided options
const defaultSettings = { zoom: 1, width: 800, cropY: 0, cropH: 0 };
const mergedSettings = {...defaultSettings,...options };
// Validate settings to prevent errors
if (mergedSettings.zoom < 0.1 || mergedSettings.zoom > 5) {
console.error("Invalid zoom level. Please provide a value between 0.1 and 5.");
return;
}
if (mergedSettings.width <= 0) {
console.error("Invalid width. Please provide a positive value.");
return;
}
if (mergedSettings.cropY < 0 || mergedSettings.cropH < 0) {
console.error("Invalid crop settings. Please provide non-negative values.");
return;
}
// Navigate to the specified URL with custom settings
$TS.screen(url, mergedSettings);
}
// Example usage
navigateToUrlWithCustomSettings('act.com/fr-fr/produits/act-premium', {
zoom: 0.5,
width: 680,
'crop-y': 400,
'crop-h': 400,
});
$TS.screen()
is a function call, likely part of a TestComplete scripting API.act.com/fr-fr/produits/act-premium
is the URL of the web page to be displayed.zoom:.5
sets the zoom level of the page to 50%.width: 680
sets the width of the page to 680 pixels.'crop-y': 400
sets the crop origin to 400 pixels from the top of the page.'crop-h': 400
sets the crop height to 400 pixels.