The sections below quickly show you 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, AppDynamics recommends reading the Selenium Python Bindings documentation.
Before running your scripts in Synthetic Jobs, AppDynamics recommends reading the differences between Python and synthetic scripts as you may need to make some modifications.
Tools for Writing Scripts
If you are comfortable with WebDriver, but just want help with the tedious work of finding DOM selectors, you can use AppDynamics WebDriver Scripting Assistant, which is a Chrome extension.
If you want a full-fledged script recorder, you can 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.
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:
The driver initialization code can be removed because the variable
driveris automatically created and initialized with the browser selected in the Job creation UI. Thus, the example code below that initializes a driver would be replaced by our logic that then returns the variable
If your script initializes a driver, it is okay to keep it: Synthetic will just ignore your initialized driver and instead return the driver it automatically created.
- Only one driver can be run within a synthetic session. Any attempt at creating new drivers will return the automatically instantiated driver (a singleton).
- Scripts interacting with multiple windows will work; however, the session results will merge the results for all windows into one waterfall.
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:
- From the New Job dialog, check the Run a script radio button.
- Enter My First Script in the Name field.
- Take a look at the sample WebDriver script, but don't change it.
- For Choose Browsers, select Chrome and Firefox.
- For Choose Locations, add a couple of different locations.
- Click Save.
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:
It will return the time as:
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.
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.
To see the metrics as charts, click the Charts tab:
From the Records tab, you can double-click a session to view the Session Details dialog: