SetBrowserSize Method

Window

SetBrowserSize is declared for the browser window.

Action

Sizes the browser window.

Availability

This functionality is supported only if you are using the Classic Agent. For additional information, refer to the Silk Test Classic Classic Agent Help.

Syntax

browser.SetBrowserSize (iWidth, iHeight)
Variable Description
iWidth The new width of the browser window, in pixels. INTEGER.
iHeight The new height of the browser window, in pixels. INTEGER.

Notes

SetBrowserSize sizes the browser window, moving it if necessary to establish the specified size. If the window cannot be sized as specified, Silk Test Classic issues a warning, but lets the test case proceed.

This method is called automatically by the recovery system (in the DefaultBaseState function) if the main page of your application has the constant BrowserSize defined and set, in which case the width and height defined for BrowserSize are passed automatically to SetBrowserSize.

By default, when you generate a test frame, the declaration for BrowserSize is commented out. If you want the recovery system to resize the browser window, un-comment the declaration in your test frame and provide appropriate values. Having the recovery system set the size of the browser window ensures maximum portability of your window declarations in different testing sessions and between browsers.

You can also call SetBrowserSize manually in a test case.

Example

The following code fragment sets the browser to take up about half the width and most of the height on the desktop on a screen with resolution set at 1280 by 1024.

Browser.SetActive ()
Browser.SetBrowserSize (650, 900)