Website Monitoring With Selenium and AlertSite

Selenium is an open-source tool for automating browser-based applications. Selenium scripts test your website by simulating user behavior – they navigate through web pages, click links, submit forms, and verify that the expected text or elements are present on the pages.

AlertSite Enterprise lets you use Selenium scripts to ensure your critical business transactions are working correctly. You can upload Selenium scripts and run them from AlertSite’s global monitoring locations, measuring the transaction response time. Selenium scripts run in real browsers – Chrome and Firefox – so they accurately model real user experience.

In This Topic

Supported Technologies

* Firefox support is in beta and there are some known issues.

Selenium 1.0 (RC) and Selenium Grid are not supported.

Private locations support Selenium monitors starting from Private Node Server v. 2.0.

Note: Selenium monitors are full-page monitors and consume credits at the Full Page rate.

Preparing JAR File for AlertSite

It is easy to reuse your Selenium scripts written in Java to create AlertSite monitors. All you need to do is to add two small code snippets into your working Java code, then export your project as a runnable JAR file.

Check out the step-by-step tutorials:

 

As a result, you will get a JAR file that can be run using this command:

java -jar filename.jar

Before you upload it to AlertSite, make sure it is played back successfully on your computer.

See also Guidelines for Selenium Scripts.

Creating a Selenium Monitor in AlertSite

Once you have a runnable JAR file, you can upload it to AlertSite:

  1. On the Dashboard, click the big +, then click + New Monitor.
  2. Select Web and click Upload and Monitor.

    Upload a Selenium script

  3. If you have multiple AlertSite plans, select the plan to be used for this monitor.

    Note: For the VM Node plan (monitoring from private locations only), make sure you use Private Node Server 2.0, because earlier versions do not support Selenium.

  4. Click Continue.
  5. Browse for your JAR file and click Submit.
  6. Name your monitor and select the run interval (default is 5 minutes).

    Selenium monitor name and run interval

  7. Click Create Monitor.
  8. On the next screen, you can run a test on demand to verify your JAR file. This is only required if your Selenium monitor will run from AlertSite’s global locations. If you selected the VM Node plan for your monitor, skip this test.

    When you are ready to continue, click No thanks, I'm done.

    I'm done

  9. The next screen is the monitor configuration, where you can select locations for the monitor, configure timeouts and other parameters.

    Note: By default, new Selenium monitors are disabled. You need to enable the monitor manually by setting Monitoring to On On.

    Selenium monitor settings

    Some useful configuration options are:

    For more information about these and other settings, see Selenium Monitor Settings.

  10. Click Start Monitoring Now!

Your Selenium monitor will now run at the configured intervals. The data should appear on AlertSite dashboards in about 5-10 minutes.

Selenium monitoring results

Understanding Selenium Run Results

How It Works

AlertSite locations have the Firefox and Chrome browsers installed. Each Selenium script begins the run with a clear browser cache. The script launches and closes a browser, navigates to web pages and simulates user actions on the pages. As the script runs, AlertSite tracks which pages are opened and measures the response time for each web page. Individual pages are reported as monitor steps.

AlertSite monitor steps are based on Selenium script actions

OK/Error Status

The monitor status in AlertSite is determined by the exit code of the JAR file rather than the status of individual web pages. The JAR file must return status 0 if all tests were successful and a status > 0 on error, as shown here. This means that if an error occurred during the script (for example, a page could not be loaded), but the script returned exit code 0, the monitor status will be OK.

Page errors (like HTTP errors or loading timeouts) are indicated in the monitor run details and in reports, but do not affect the monitor status and your SLA metrics.

AlertSite does not specifically track the status of JUnit test cases (@Test methods) in your JAR file, but you may be able to see this information in the run log.

Monitoring Results

In addition to the overall OK/error status, Selenium monitoring results include:

Page Waterfalls and Content Breakdown

Clicking Waterfall next to individual pages in test run results opens the Run View with waterfall charts and content breakdown. Here you can see the slowest and largest objects that affect your web page response time.

Waterfall chart

Run Log

AlertSite can save the console output from Selenium monitors to help with troubleshoot monitor status 20 “Selenium-specific error”. The monitor needs to have the Capture Level option set to enable this. The console output will be available as the Run Log in the monitor run results.

The run log includes:

Here is a sample run log that shows the error details:

JUnit log

You can also have this log attached to email alerts. To do this, select the Attach server response to email alerts option for your email alert recipients.

Limitations and Known Issues

Unsupported Features

The following features are not supported for Selenium monitors:

Firefox Support

Support for Selenium Firefox monitors is currently in beta. The following issues are known to exist:

Warnings in Run Log

Selenium Run Log may include the following warnings at the beginning:

[AppClassLoader@18b4aac2] warning Cannot access resource for -Xlintfile:META-INF/Xlint.properties
[URLClassLoader@180bc464] warning Cannot access resource for -Xlintfile:META-INF/Xlint.properties

You can ignore these warnings. They do not affect the functionality of your Selenium scripts.

See Also

© 2017 SmartBear Software. All rights reserved.      Terms of Use · Privacy Policy