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

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 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:

  • 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

  • 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.

  • Click the selected target to open the target configuration page.
  • On the target configuration page, expand the Site Login section, and select the following option: Use pre-recorded login sequence

 

  • Click Import From Selenium and choose the Selenium script saved earlier.
  • 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

  • Click OK on the pop-up stating that the script was imported successfully.
  • Confirm the restricted links and the identified session detection pattern and click Save when done.
  • 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.

  • Open the command prompt
  • Enter the command prompt and change the current directory to C:\Program Files (x86)\Acunetix\core\
  • 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"

  • 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

  • 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.

 

« Back to the Acunetix Support Page