Selenium is a tool that allows you to automate browser actions. It is often used by QA engineers to automatically and efficiently test the functionality of web applications. You can create Selenium scripts that examine specific functionality of a web application, ensuring that it produces the expected results.

One of the types of pages that you need to test in the case of most web applications are login pages. Selenium scripts are often used to ensure that changes in the web application do not break the login functionality. These Selenium scripts can now be converted and used by Acunetix to log into the site as part of the security scan.

The Login Sequence Recorder in Acunetix v13 has been updated to support converting Selenium Login Scripts into Login Sequence Files, which can then be used within Acunetix. The login actions are taken from the Selenium script. The Auto-Login feature is used to identify any restricted links, such as Logout links, and the session detection pattern.

To convert the Selenium Login Script into a Login Sequence File:

1. Confirm that the Selenium Login Script is working as expected. You can do it using the Play button to confirm that all the steps are executed correctly. Use the Timer drop-down to configure the playback speed.

Selenium Login Script

2. Save the Selenium Login Script to a file.

How to Convert Selenium Scripts to Acunetix LSR Files from the Acunetix UI

In this procedure, you will learn how to import the Selenium Script using the Acunetix UI. See below if you want to know how to convert Selenium scripts to Acunetix LSR files from the command line.

1. Click the selected target to open the target configuration page.

2. On the target configuration page, expand the Site Login section, and select the following option: Use pre-recorded login sequence

Use pre-recorder login sequence

3. Click Import From Selenium and choose the Selenium script saved earlier.

4. The Login Sequence Recorder will open the Selenium script, convert it to a login sequence, and run through the actions identified. In addition, it will automatically identify any logout links and the session detection pattern.

Confirm login sequence import

5. Click OK on the pop-up stating that the script was imported successfully.

6. Confirm the restricted links and the identified session detection pattern and click Save when done.

7. You will be taken back to the target configuration page and the new LSR file will be attached to the target. Click Save to confirm the changes to target settings.

How to Convert Selenium Scripts to Acunetix LSR Files from the Command Line

Use the following procedure to convert Selenium scripts to Acunetix LSR files from the command line. This can be useful if you need to convert many Selenium scripts into Acunetix LSR files. You can then use the Acunetix API to auto-attach the scripts to targets.

1. Open the command prompt

2. Enter the command prompt and change the current directory to C:\Program Files (x86)\Acunetix\core\

3. Execute the following command:

node lsr generate --sourcetype selenium 
  --source source_selenium_file 
  --destination destination_LSR_file

For example:

node lsr generate --sourcetype selenium 
  --source "C:\users\admin\Downloads\testphp_login.side" 
  --destination "C:\users\admin\Downloads\testphp_login.lsr"

4. The Login Sequence Recorder will load the Selenium file and create login actions. It will then proceed with verifying login actions as well as identifying restricted links and a valid session detection pattern. This might take some time to complete. Progress will be visible in the command prompt window.

Selenium Conversion Command Prompt

5. You can now upload the resulting .lsr files to the Target configuration > Site Login section for different targets or use the Acunetix API to attach the LSR to a specific target.

Selenium Conversion Upload

SHARE THIS POST
THE AUTHOR
Nicholas Sciberras
Chief Technical Officer
As the CTO at Acunetix, Nicholas is passionate about IT security and technology at large. Prior to joining Acunetix in 2012, Nicholas spent 12 years at GFI Software, where he managed the email security and anti-spam product lines, led multiple customer service teams and provided technical training.