Requirements and Authentication for Selenium Web Checks

Last updated on 25 July, 2023

Requirements

  • To record a browser transaction, you need the Selenium IDE Chrome Extension.
  • Manage permissions for all listed resources in Resource Tab.
  • Access permission to the Synthetics Monitoring for adding the new synthetic web test.
  • An active collector should be configured with the grid URL.

Authentication

You can add authentication to your Synthetics Web Checks with the following actions:

  • Parameterizing the appropriate credentials inside the Selenium .side file
    This can be accomplished after you record your browser transaction by modifying the .side file with the appropriate authentication.
  • Specifying the credentials when uploading the Web check to LogicMonitor
    You can specify the credentials in a step of the Synthetics Website Test wizard in your LogicMonitor portal

Note: In addition to authentication, you can specify a LogicMonitor property while uploading the .side file in the portal using the wizard. Specify in the format {synthetics.variable.variableName}. For example, synthetics.selenium.test.timeout.

Credentials consist of a username and password if you are using multi-factor authentication (MFA) token. LogicMonitor leverages the existing variable substitution in Selenium IDE to securely inject your authentication information.

Recording a Browser Transaction

Follow the Getting Started instructions from Selenium to record a browser transaction.

Recommendation: You can add WAIT_FOR_ELEMENT_VISIBLE property in the .side file and set the value greater than zero to allow a waiting period for the elements to load. A timeout error displays, If the elements don’t load in the specified period

When complete, save your .side file in a location you can access for uploading to LogicMonitor.

Note: Selenium allows you to connect to a session using a VNC viewer to watch the browser as a test executes. You can connect VNC directly to the exposed node port using a VNC viewer (For example, VNC Connect).).
Selenium Grid 4 includes a NoVNC web viewer. Exposing port 7900 allows you to open the port in a browser and see the VNC viewer activity without installing a viewer. If you use the provided docker-compose file, you would use the following:
– Chrome: “http://:7900”
– Edge: “http://:7901”
– Firefox: “http://:7901”
See the following for additional tips:
Debugging.
You can also run “Poll now” on the Selenium Webcheck to see any error messages that may be encountered.

Adding Authentication to the Browser Recording

To add authentication, you must parameterize the credentials in the Selenium .side file by replacing each instance of username, password, and token with the appropriate variable substitution.

Variables can be substituted in Selenium IDE text fields by surrounding a variable name with ${}. For example, to substitute the value of the variable myVar into the condition of an if statement would look similar to the following:
${myVar} === "a".

For more information, see Selenium’s Conditional Branching documentation.

LogicMonitor uses the following special variables to substitute your credentials username, password, and token respectively:

  • credential.username 
  • credential.password
  • credential.token
Selenium IDE screen

Note: Each credential field (username, password, and token) are printed to the execution log using the echo command.

Recommendation: Specify multiple test user accounts to be added to a “pool” of users that the test pulls from. This ensures MFA can be tested properly and avoids situations where one specific test user is attempting to log in too many times from different locations.

In This Article