Menu

How to Convert Selenium Scripts to Virtual Browser Scripts

Web Performance has discontinued direct support for Selenium/WebDriver in Load Tester. One of the limitations of load testing with Selenium/Web Driver is that it takes lots and lots of cloud machines to generate load. Virtual users, on the other hand, are very efficient, cheaply simulating up to millions of users. This blog post shows one possible option, playing back your selenium scripts directly into the Load Tester recorder where they can be edited and played back with lots of virtual users.

Install Load Tester

Download Load Tester and install it on your Windows machine if you haven’t already.  Double-click on the installer and follow the instructions.

Install Firefox and the Firefox SSL Certificate

Since Selenium IDE runs inside Firefox it will be need to be configured to record with Load Tester. Note that this process also works if you’ve written selenium scripts in a programming language, but in that case wherever the instructions say to start playback in the IDE you’ll have to do that within your programming environment.

You should already have Firefox installed if you’re using Selenium, but if not, download and install it now. Recording with Firefox from Load Tester will automatically install the special SSL certificate needed to enable recording.

To do this first click on the red Record Button, below.


Then select the Firefox icon:


The program will then ask you to install the SSL certificate:

Click on the stop recording button to stop the recording process for now so we can complete the configuration process.

Configure HTTP Proxy Settings

For recording to work Firefox’s HTTP proxy must be configured to route HTTP traffic through Load Tester. Go to Firefox’s proxy settings and use the IP address 127.0.0.1, and the port
2525 for HTTP and 2526 for SSL. Menu->Options->Advanced->Network.

Load Tester normally randomly generates its own port values. For this to work you’ll need to turn off that feature. From within Load Tester go to Window->Preferences->Load Tester->Recording and make sure “Manually Select Recording Ports” is checked.

Playback and Record a Selenium Script

Start a recording in Load Tester again by clicking on the red record button:

This time, however, instead of selecting Firefox, click on Show More Options:

This will bring up the option to do system-wide HTTP recording. Select “No Browser – Capture Systemwide Traffic”, and click “OK”.

 

Once Load Tester recording has started you can then initiate playback either from Selenium IDE or by starting a programming language script containing Selenium/WebDriver code.   To start Selenium IDE go to the Firefox menu and select Selenium IDE:

If you’re using Selenium IDE be sure to select the slowest playback speed so that Load Tester can group the HTTP requests into web pages by moving the speed slider all the way to the right to “Slow”:

When playback has started you should notice that web pages are starting to show up inside Load Tester:

When playback finishes click on Load Testers big “stop recording” button.

Separate Web Pages

Load Tester uses the natural rhythm of real users to separate out HTTP requests into web pages, but Selenium IDE will try to play back the requests as fast as possible, even on slow mode, with no think time like a real user.  This can sometimes cause the page groupings to be off.  To fix this, expand the web pages one by one, and see if you can identify the start of a new web page.  When you find one, right-click on it and select “Start new Web Page with URL”.  This will create a new web page grouping with that URL and any subsequent URLs already in the current web page.

The recording should now have recognizable web pages more like from the Selenium script:

 

Configure The Script

Now that the test case is in Load Tester there’s a wide variety of customizations available.  The most common is to configure data replacement, so that each user has a separate user name and password, for example, or types in separate information into forms.  There are a large number of tutorials available, or just type your question into the search bar and search the entire site.

Add Your Comment

You must be logged in to post a comment.

Resources

Search

Copyright © 2017 Web Performance, Inc.

A Durham web design company

×

For Prices Call (1) 919-845-7601 9AM-5PM EST

After hours? Prefer email? Just complete this form and we will get back to you as soon as possible with a quote. Please note: Technical support questions should be posted to our online support system.

About You
Product Needs
×

Request a Quote

Our experienced performance engineers have tuned hundreds of systems for companies large and small, and know just where to look, saving you time to market and money. We'll run your website through a complete performance evaluation, then tell you exactly how many users your site can support, including such important details as the effects of "the last mile." We'll also pinpoint potential problem areas and give you a full report detailing what needs to be fixed and where.

About You
Product Needs