Browsers
- 4 minutes to read
This topic lists browsers supported by TestCafe, and describes how to specify browser options and use features such as device emulation.
Supported Browsers
TestCafe Studio supports the latest version of the following browsers unless specified explicitly:
- Google Chrome: Stable, Beta, Dev and Canary
- Internet Explorer (11+)
- Microsoft Edge (legacy and Chromium-based)
- Mozilla Firefox
- Safari
- Google Chrome mobile
- Safari mobile
NOTE
You can run tests in desktop, headless, remote and mobile browsers. However, recording is available only in desktop browsers.
Browser Command Line Flags
You can specify options that TestCafe Studio uses to launch browsers in the Run Configuration Dialog. Expand Browser Options and specify the flags in the CLI flags field.
NOTE
For a list of browser options, refer to the following resources:
- Chromium Command Line Switches for Google Chrome, Chromium, and the new Microsoft Edge.
- Firefox Command Line Options
- IE Command-Line Options
Note that Safari does not support command line flags.
Chromium Device Emulation
You can run tests with Chromium's built-in device emulator in Google Chrome, Chromium and Chromium-based Microsoft Edge.
Open the Run Configuration Dialog, expand Browser Options, and specify emulation settings in the Emulated device field.
Use the equal sign (=
) to join a parameter name and a value. Separate parameters with semicolons (;
) - do not use spaces.
Emulate a Device
Specify the target device with the device
parameter.
NOTE
See the full list of supported devices in DevTools -> ⋮ -> Settings -> Devices
Emulate Screen Size
You can specify parameters such as width
, height
, or orientation
to configure the device emulator.
Substitute a User Agent
Use the userAgent
parameter to substitute a user agent string.
WARNING
TestCafe relies on a user agent string to emulate browser behavior. Tests are not guaranteed to run correctly if you specify a user agent that is invalid or not supported by TestCafe.
Note that you need to escape semicolons (;
) with double backslashes in the user agent string.
Emulation Parameters
Use the following parameters to configure the Chrome device emulator. Specify them after the emulation
parameter as in the examples above.
Parameter | Type | Description | Default |
---|---|---|---|
device (optional) |
String | The emulated device name (see the full list of supported devices in DevTools -> ⋮ -> Settings -> Devices). | No default value. |
width (optional) |
Number | The device screen width in pixels. | The width of the selected device. If the device parameter is not set, the default browser width is used. |
height (optional) |
Number | The device's screen height in pixels. | The height of the selected device. If the device parameter is not set, the default browser height is used. |
scaleFactor (optional) |
Number | Device scale factor value. | Depends on the selected device or your system parameters. |
mobile (optional) |
Boolean | Defines whether to emulate a mobile device. This includes the viewport meta tag, overlay scrollbars, text autosizing, etc. | true if a mobile device is set via the device property. Otherwise, false . |
orientation (optional) |
vertical | horizontal |
The device orientation | vertical |
userAgent (optional) |
String | The user agent string | The user agent string of the selected device or the browser. |
touch (optional) |
Boolean | Enables or disables touch event emulation. | true if a touch-supported device is set via the device property or your system supports touch events. Otherwise, false . |
cdpPort (optional) |
Number | A port (0-65535) used for Chrome Debugging Protocol. | 9222 if you enable Load user profile. Otherwise, TestCafe automatically assigns a free port. |
User Profiles
TestCafe Studio starts browsers with an empty profile to ensure consistent test results on different machines. However, you can run tests with the current user profile in Chromium browsers and Firefox.
To do this, enable the Load user profile setting in the Browser Options section of the Run Configuration dialog.
NOTE
You cannot load the current user profile in headless mode.