Browser Tests

Overview

Browser tests are scenarios executed by Datadog on your web applications. They run at configurable periodic intervals from multiple locations around the world, from multiple browsers, and devices. These tests verify both that your applications are up and responding to requests, and that any conditions defined in your scenarios are met.

If you are interested in testing applications that sit behind MFA, read the dedicated guide and send feedback to the Synthetic Monitoring team to help improve the systems that matter most to your teams.

Test configuration

Define the configuration of your browser test.

  1. Starting URL: The URL from which your browser test starts the scenario.
  2. Advanced Options (optional): Set specific options for your browser test.

Select Disable CORS to prevent the cross-origin resource sharing (CORS) policy from blocking your test.

  • Request Headers: Define headers in the Name and Value fields to add to or override the default browser headers. For example, you can set the User Agent in the header to identify Datadog scripts.
  • Cookies: Define cookies to add to the default browser cookies. Enter one cookie per line, using the syntax of Set-Cookie.
  • HTTP Authentication: Authenticate through HTTP Basic, Digest, or NTLM with a username and a password. Your credentials are used in every step of your browser test.

Request options are set at every test execution and apply to every step of your browser test at execution time, not recording time. If you need these options to remain active to record the following steps, manually apply the options on the page you are recording from and create subsequent steps in your test.

Select Ignore server certificate error to instruct the test to skip errors in the server certificate.

  • Client Certificate: Perform tests on systems that require client certificates by clicking Upload File and uploading your certificate file and private key. Only PEM certificates are accepted.
  • Client Certificate Domains: Once the certificate files are uploaded, the client certificate applies to the starting URL’s domain. To apply the client certificate on another domain, specify the domain in the Value field.

You can include wildcards in the URL.

Enter a URL for a proxy you want to send requests through in the Proxy URL field as http://<YOUR_USER>:<YOUR_PWD>@<YOUR_IP>:<YOUR_PORT>.

You can include global variables in the URL.

Select Do not capture any screenshots for this test to prevent screenshots from being taken in your test steps.

This privacy option is available as an advanced option at the individual test step level and ensures that no sensitive data appears in your test results.

Preventing the test from taking screenshots makes troubleshooting failures more difficult. For more information, see Security.

  1. Name: The name of your browser test.
  2. Select tags: The env and related tags attached to your browser test. Use the <KEY>:<VALUE> format to filter on a <VALUE> for a given <KEY>.
  3. Browsers & Devices: The browsers (such as Chrome, Firefox, Edge, and Internet Explorer 11), and devices (such as Laptop Large, Tablet, and Mobile Small) to run your test on.
    • For a large laptop device, the dimensions are 1440 pixels x 1100 pixels.
    • For a tablet device, the dimensions are 768 pixels x 1020 pixels.
    • For a small mobile device, the dimensions are 320 pixels x 550 pixels.
  4. Select locations: The Datadog managed locations to run your test from. Many AWS locations from around the world are available for each site. You can also set up private locations to run your browser test from custom locations or from inside private networks. See a full list of locations in the Datadog app or use the API.

    Note: The West US (AWS GovCloud) location is supported on the Datadog for Government site.

  5. Select test frequency: The intervals vary from every five minutes to once per week. Contact Support for one-minute frequency.

Use global variables

You can use the global variables defined in the Settings in the Starting URL as well as in the Advanced Options of your browser tests. To display your list of variables, type {{ in the desired field.

To use global variables in your browser test’s recording, navigate to your recorded steps and click + Variables below the Start Recording button. Select Global Variable from the dropdown menu.

Available Global Variables

Search for available global variables and click + to add them to your recording panel. When you are done adding global variables, click OK.

Define alert conditions

You can customize alert conditions to define the circumstances under which you want a test to send a notification alert.

  • An alert is triggered if any assertion fails for X minutes from any n of N locations. This alerting rule allows you to specify for how much time and on how many locations a test needs to fail before triggering the notification.
  • Retry X times before location is marked as failed. This allows you to define how many consecutive test failures need to happen for a location to be considered as failed. By default, there is a 300ms wait before retrying a test that failed. This interval can be configured with the API.
Browser test alerting rule

Notify your team

A notification is sent according to the set of alerting conditions. To configure your notifications:

  1. Enter a message for the browser test. This field allows standard Markdown formatting and supports the following conditional variables:

    Conditional VariableDescription
    {{#is_alert}}Show when monitor alerts
    {{^is_alert}}Show unless monitor alerts
    {{#is_recovery}}Show when monitor recovers from either ALERT
    {{^is_recovery}}Show unless monitor recovers from either ALERT

    Notification messages include the message defined in this section and information about the failing locations.

  2. Choose your services and/or team members to notify.

  3. Specify a renotification frequency. To prevent renotification on failing tests, leave the option as Never renotify if the monitor has not been resolved.

  4. Click Save Details and Record Test.

Record your steps

Tests can be only recorded from Google Chrome. To record your test, download the Datadog Record Test extension for Google Chrome.

You can switch tabs in a browser test recording in order to perform an action on your application (such as clicking on a link that opens another tab) and add another test step. Your browser test must interact with the page first (through a click) before it can perform an assertion. By recording all of the test steps, the browser test can switch tabs automatically at test execution.

Browser test record test
  1. Optionally, select Open in a pop-up at the upper right of the page to open your test recording in a separate pop-up window. This is useful if your application does not support being opened in an iframe or if you want to avoid sizing issues at recording. You can also open the pop-up in Incognito mode to start recording your test from a fresh browser free from already logged-in sessions, cookies from your existing browser, and more.

  2. Optionally, enable Datadog to automatically collect RUM data when running step recordings from your browser test. For more information, see Explore RUM & Session Replay.

  3. Click Start Recording to begin recording your browser test.

  4. As you click on your application going through the user journey you want to monitor, your actions are automatically recorded and used to create steps within your browser test scenario on the left.

  5. In addition to the automatically recorded steps, you can also use the steps available in the upper left corner to enrich your scenario:

    Browser Test steps

    Note: You should always make sure to end your browser test with an assertion to confirm the journey executed by the browser test resulted in the expected state.

  6. Once you have finished your scenario, click Save and Launch Test.

Permissions

By default, only users with the Datadog Admin and Datadog Standard roles can create, edit, and delete Synthetic browser tests. To get create, edit, and delete access to Synthetic browser tests, upgrade your user to one of those two default roles.

If you are using the custom role feature, add your user to any custom role that includes synthetics_read and synthetics_write permissions.

Restrict access

Access restriction is available for customers using custom roles on their accounts.

You can restrict access to a browser test based on the roles in your organization. When creating a browser test, choose which roles (in addition to your user) can read and write your test.

Set permissions for your test

Further Reading