add_browser method

Class: ConfigurationPlatform: Selenium 3Language: Python 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 desktop_browser_info below. You can also request a browser directly using the browser_type 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 chrome_emulation_info 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 ios_device_info 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 add_browsers.

Syntax


configval = config.add_browser(desktop_browser_info)

configval = config.add_browser(ios_device_info)

configval = config.add_browser(chrome_emulation_info)

configval = config.add_browser(width, height, browser_type)

configval = config.add_browser(width, height, browser_type, baseline_env_name)

Parameters

desktop_browser_info
Type:DesktopBrowserInfo

Which desktop browser type and viewport size to use.

suite_config = (Configuration() 
    .add_browser(DesktopBrowserInfo(viewport_width, viewport_height, BrowserType.EDGE_CHROMIUM))  
    # ... other configurations    
    )  
ios_device_info
Type:IosDeviceInfo

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

suite_config = (Configuration() 
    .add_browser(IosDeviceInfo(IosDeviceName.iPhone_11, ScreenOrientation.PORTRAIT))  
    # ... other configurations    
    )  
chrome_emulation_info
Type:ChromeEmulationInfo

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

suite_config = (Configuration() 
    .add_browser(ChromeEmulationInfo(DeviceName.Galaxy_S5, ScreenOrientation.LANDSCAPE))  
    # ... other configurations    
    )  
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 browser_type parameter.

height
Type:int

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

Use this in conjunction with the browser_type parameter.

browser_type
Type:BrowserType

The type of browser for this target.

suite_config = (Configuration() 
    .add_browser(viewport_width, viewport_height, BrowserType.CHROME)  
    # ... other configurations    
    )  
baseline_env_name
Type:Text

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 browser_type 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 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.