Related pages:

This page describe how to create a synthetic job and view the results.

Write a Script

Before you create a Synthetic Job with a custom script, you will need to write a Python WebDriver script and get it working locally. For a good introduction to scripting, recommends reading the Selenium Python Bindings documentation.

Before running your scripts in Synthetic Jobs, recommends reading the differences between Python and synthetic scripts as you may need to make some modifications.

Tools for Writing Scripts

For a full-fledged script recorder, use the Firefox add-on Katalon Recorder (Selenium IDE for Firefox 55+)The resulting script will work with Browser Synthetic, but as with most auto-generated code, expect to make manual changes to improve it.

Constraints for Writing Scripts 

driver.get should always point to a proper HTML page and not to resources. 

  • driver.get() works well for HTML pages.
  • Some of the session data might be incomplete or incorrect if you try to get resources directly.

Test Scripts Locally

Testing scripts locally is one of the best ways to take advantage of utilities to help you write scripts and then run them locally. To run scripts locally, complete the installation instructions given in the Selenium Python Bindings documentation and then run the script as you would any Python script.

Understand the Differences Between Python and Synthetic Scripts

When you are ready to write synthetic scripts, you should be aware that although Browser Synthetic can run unmodified Python scripts, there are few differences: 

Create a Synthetic Job with Your Script

Once you have completed and tested your scripts, the next step is to create a Synthetic Job with your script:

  1. From the New Job dialog, check the Run a script radio button.
  2. Enter My First Script in the Name field. 
  3. Take a look at the sample WebDriver script, but do not change it.
  4. For Choose Browsers, select Chrome and Firefox.
  5. For Choose Locations, add a couple of different locations.
  6. Click Save.

View Results

All date and time functions in the synthetic script return time in the UTC time zone. For example, if a script is scheduled on July 30 at 12am PST from the San Francisco location, and in the script it calls the following function:

import datetime 
..... 
dt = datetime.datetime.now() 
print(str(dt))

It will return the time as:

2020-07-30 07:00:00.000000


You have two types of views for the results. From the Jobs page, where you create a job, you can see your job and a summary of the results after the job has been run for both Synthetic Hosted/Private Agents.

Jobs

You can also see more detailed results from the Sessions page. You can get there by either double-clicking your job or by clicking Sessions in the left navigation bar.

Sessions

To see the metrics as charts, click the Charts tab:

Sessions

From the Records tab, you can double-click a session to view the Session Details dialog:

Session Details