addBrowser method

Class: ConfigurationPlatform: Selenium 3Language: Java SDK:

Use this method to request that the Ultrafast Grid generate a checkpoint images for a particular target desktop or mobile device browser.

The following types of targets can be specified by passing different types of parameters:

  • Desktop browser: The page is rendered using a desktop browser you specify. The set of supported browsers is defined by the enum browsertype. To request a browser from this list pass a DesktopBrowserInfo object, as shown for parameter desktopBrowserInfo below. You can also request a browser directly using the browserType parameter as shown below.
  • Emulated mobile device: The page is rendered using Chrome device emulation. The set of supported devices is defined by the enum devicename. To request a device from this list pass a ChromeEmulationInfo object, as shown for parameter chromeEmulationInfo below.
  • Simulated iOS mobile device: The page is rendered using a Safari browser running on a mobile device simulator. The set of supported devices is defined by the enum iosdevicename. To request a device from this list pass an IosDeviceInfo object, as shown for parameter iosDeviceInfo below.

When requesting a Desktop browser you also specify the required viewport size. When specifying a mobile device the viewport size is based on the device screen size, and you simply specify if you want to render using portrait (vertical) or landscape (horizontal) screen orientation.

You may define multiple targets with different browsers/devices and viewports/orientations by calling this method as many times as required. Eyes will produce a test results for each such configuration. Alternatively, you can pass a list of browsers and devices to the method addBrowsers.

Syntax


Configuration configval = config.addBrowser(desktopBrowserInfo);

Configuration configval = config.addBrowser(chromeEmulationInfo);

Configuration configval = config.addBrowser(iosDeviceInfo);

Configuration configval = config.addBrowser(width, height, browserType, baselineEnvName);

Configuration configval = config.addBrowser(width, height, browserType);

Parameters

desktopBrowserInfo
Type:DesktopBrowserInfo

Which desktop browser type and viewport size to use.

suiteConfig = new Configuration() 
    .addBrowser(new DesktopBrowserInfo(viewPortWidth, viewPortHeight, BrowserType.EDGE_CHROMIUM)) 
    /* other configs */ ; 
chromeEmulationInfo
Type:ChromeEmulationInfo

Which mobile device to emulate and its vertical or horizontal orientation.

suiteConfig = new Configuration() 
    .addBrowser(new ChromeEmulationInfo(DeviceName.Galaxy_S5, ScreenOrientation.LANDSCAPE)) 
    /* other configs */ ; 
iosDeviceInfo
Type:IosDeviceInfo

Which Apple mobile device to simulate and its vertical or horizontal orientation.

suiteConfig = new Configuration() 
    .addBrowser(new IosDeviceInfo(IosDeviceName.iPhone_11, ScreenOrientation.PORTRAIT)) 
    /* other configs */ ; 
width
Type:int

The width of the browser viewport for this target. The maximum viewport width for all browsers is 5120. If this limit is exceeded, then execution of the checkpoint will fail.

Use this in conjunction with the browserType parameter.

height
Type:int

The height of the browser viewport for this target. There is no height limit.

Use this in conjunction with the browserType parameter.

browserType
Type:BrowserType

The type of browser for this target.

suiteConfig = new Configuration() 
    .addBrowser(viewPortWidth, viewPortHeight, BrowserType.CHROME)  
    /* other configs */ ; 
baselineEnvName
Type:String

The name of the baseline environment. If provided, then the viewport, host app (browser), and OS that define the baseline are defined by the baseline environment name and not by the execution environment. The name should already be defined in the Test manager. If it is not defined, then it will be created based on the execution environment of the first test that uses that name. For more information see Running cross-environment tests.

Use this in conjunction with the browserType parameter.

Return value

Type: Configuration
The value returned is the object that called the method. This allows you to use a fluent style to call the setXXXX methods of the Configuration class.

Remarks

By default, the entire page is rendered. The viewport width and height parameters impact the baseline that is chosen, unless the baseline environment configuration or parameter has been provided. The viewport passed to the Eyes.open method does not impact the baseline used, but could impact the page layout if the page has any viewport size-sensitive factors such as HTML, CSS or Javascript.