Synthetic Scripts or Monitoring

Lakshmi Prasanna
June 21, 2021

Photo by Behnam Norouzi on Unsplash

Synthetic browser monitoring is a way to monitor your applications by simulating user actions. We create a JavaScript code snippet using the Selenium WebDriverJS library to perform the user actions virtually through scripted browsers. It also provides information about the uptime and performance of business transactions or the most commonly used sections of your application.

  • Synthetic scripts can be used to test business-critical end-user flows, features and also helps to check whether specific elements and resources are present on the user interface.
  • The test scripts can be scheduled to execute at a particular time and at different geographical locations.
  • Easy to identify the broken things in critical end-user flows.
  • Helps to improve performance by knowing where the response time of the web application is slow.

Here is an example of what a synthetic script can do:

  1. Visit and log in to a web application.
  2. Try navigating to your order or purchase list.
  3. Check whether your order list is present or not.

Are you able to see your order list? If yes, Good for you. If not, sad for you and me as well, cuz even I was not able to view them. Thanks to New Relic’s synthetic monitor for helping me to monitor this problem and fix it before a customer recognizes it. So here are few steps I followed to develop my script.

Step 1: Create a sample synthetic monitor in New Relic.

Step 2: Go to the script in the setting from the sidebar.

Step 3: Set the window size similar to the size of your web page.

$browser is a synthetic monitoring instance of selenium-webdriver.WebDriver(). It exposes some of the web driver API's like get() and findElement(). Refer the below link for more.

Step 4: Visit and log in to my web application.

.then() — The way to deal with asynchronous calls in JS is with callbacks. Let’s say we had to make multiple calls to the server, one after the other to set up the application. This becomes the nested callback hell. So there is a concept called Promise API. It was designed to resolve the nesting problem. The “then()” function returns the promise object which supports the chaining of multiple calls to the server.
$driver — provides all the exports from selenium-webdriver module. Refer for more info:

Step 5: Validate my web application’s order or purchase list page.

Step 6: Save the script and validate.

Question: Wonder how this monitor is gonna validate the script?

Answer: New Relic creates a fully virtualized Selenium-driven Google Chrome browser that navigates your website and follows each step of the script.

Once the script validation is done. Check the Timeline, script log, and Screenshot for the output.

How about you?

Are you able to view your order list page now?  


Selenium WebDriver
Application Performance
Synthetic Monitoring

About Quinbay

Quinbay is a dynamic one stop technology company driven by the passion to disrupt technology today and define the future.
We private label and create digital future tech platforms for you.

Digitized . Automated . Intelligent