Desktop web applications which are built based upon responsive web design might change their appearance in response to the
size of the screen or web browser in which these applications are displayed. Choosing the appropriate size of the replay window
might have significant impact on the stability of such tests.
Silk Test Classic enables you to specify the exact size of the browser window in the following situations:
- When you add an application configuration for a web application to a project.
You can use the following settings to specify the size of the browser window:
- The
Browser size list contains a mix of predefined and custom browser window sizes, enabling you to select the size on which you want to test.
- The
Orientation list enables you to select whether you want the browser window to use landscape or portrait orientation.
- Click
Edit Browser Sizes to add custom browser sizes to the
Browser size list or to specify which browser sizes are displayed in the list.
- To add a new custom browser size to the list, click
Add Browser Size.
- To exclude a size from the list, uncheck the corresponding check box.
- To add the visual breakpoints of a specific web application to the
Browser size list, click
Detect Visual Breakpoints.
When replaying a test against a web application from the command line or from
Silk Central, you can specify the size of the browser viewport by setting the
silktest.browserViewportSize environment variable. You can either specify the name of a browser from the
Browser Size list or a specific size.
You can change the size of the browser directly in a test script:
[] WebBrowser.BrowserWindow.SetViewportName("Google Pixel 2")
[] WebBrowser.BrowserWindow.SetViewportSize(800,300)
Example: Setting the browser size for automated replay by using the name
The following code sample sets the browser size to SVGA (800, 600) by using the SVGA entry of the
Browser size list:
SET silktest.browserViewportSize=name=SVGA;orientation=landscape
Example: Setting the browser size for automated replay by using the width and height
The following code sample sets the browser size to SVGA (800, 600) by using the
width and
height parameters:
SET silktest.browserViewportSize=width=800;height=600;orientation=landscape