You can create Selenium scripts using Qualys Browser Recorder to record and play back functions in web applications during scanning. For each web application in your account, you can create scripts to configure authentication and crawling for web application scanning.
Qualys Browser Recorder is a free browser extension to record & play back scripts for web application automation testing. Qualys Browser Recorder includes the entire Selenium Core, allowing you to capture web elements and record actions in the browser to let you generate, edit, and play back automated test cases quickly and easily. It also allows you to select a UI element from the browser’s currently displayed page and then select from a list of Selenium commands with parameters.
You just need to download and install the latest version of the Chrome web browser. The user needs to be aware of basics of Javascript and HTML concepts to execute effective and successful automation test scripts.
Here are the steps for quick installation of Qualys Browser Recorder:
Step 1: Open the Google Chrome browser and go to Chrome Store. Search for Qualys Browser Recorder in the Chrome store.
USE OF THIS EXTENSION SHALL BE DEEMED TO BE ACCEPTANCE OF THESE TERMS. THIS EXTENSION IS PROVIDED TO YOU "AS IS." TO THE EXTENT PERMITTED BY LAW, QUALYS
HEREBY DISCLAIMS ALL LIABILITY FOR THE PROVISION OR USE OF THIS EXTENSION.
Step 2: Once the web page is loaded, click Add to Chrome.
Step 3: Click Add extension in the new pop-up window that is displayed.
As soon as you complete the installation steps, a small pop window is displayed indicating Qualys Browser Recorder has been successfully added to your browser.
When you open Qualys Browser Recorder, the record button is at the upper right corner. Click the record button and it will start recording your actions.
During recording, Qualys Browser Recorder automatically inserts commands into your test case based on your actions. Typically, this may include:
-clicking a link - click or clickAndWait commands
-entering values - type command
-selecting options from a drop-down listbox - select command
-clicking check boxes or radio buttons - click command
We currently support only one parameter in WAS that can be used in the Selenium script.
WAS Parameter |
Description |
@@webappURL@@ |
Use to fetch base URL of the web application. |
@@authusername@@ |
Use to fetch username of the login form. |
@@authpassword@@ |
Use to fetch password of the login form. |
Script Sample without ParametersScript Sample without Parameters
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta content="text/html; charset=UTF-8" http-equiv="content-type" /> <link rel="selenium.base" href="http://example.com/" /> <title>New_Staging_Script_14Feb-1</title> </head> <body> <table cellpadding="1" cellspacing="1" border="1"> <thead> <tr><td rowspan="1" colspan="3">Untitled Test Case</td></tr> </thead> <tbody> <tr><td>open</td><td>http://example.com/</td><td></td> </tr><tr><td>sendKeys</td><td>name=email</td><td>test@example.com</td> </tr><tr><td>sendKeys</td><td>name=password</td><td>password</td> </tr> <tr><td>click</td><td>id=SignInButton</td><td></td> </tr> </tbody></table> </body> </html>
Script Sample with URL ParameterScript Sample with URL Parameter
If you want to use baseURL as URL for selenium open command then can use @@webappURL@@ macro as shown in below script.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta content="text/html; charset=UTF-8" http-equiv="content-type" /> <link rel="selenium.base" href="http://example.com/" /> <title>New_Staging_Script_14Feb-1</title> </head> <body> <table cellpadding="1" cellspacing="1" border="1"> <thead> <tr><td rowspan="1" colspan="3">Untitled Test Case</td></tr> </thead> <tbody> <tr><td>open</td><td>@@webappURL@@</td><td></td> </tr><tr><td>sendKeys</td><td>name=email</td><td>test@example.com</td> </tr><tr><td>sendKeys</td><td>name=password</td><td>password</td> </tr> <tr><td>click</td><td>id=SignInButton</td><td></td> </tr> </tbody></table> </body> </html>
Open a blank browser tab and then click the play button in Qualys Browser Recorder. As the script runs, the web application will appear in the browser and the script you recorded will play automatically.
Upload the script to a web application in your account. Simply edit the web application and upload it. You can upload a Selenium script in the Crawl Settings and in the Web Application Record settings.