< Back to Blog Overview

How to create a Selenium test

  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn
  • Share on HackerNews

In this blogpost we'll talk about creating your first Selenium test, running the test on your own computer and then later run it on several browsers at once. It shouldn't be too hard to follow along, but if you have any questions or remarks, please leave a comment.


Before we can create a test, we first need a website and an idea of what to test on the website. Let's say we have an e-commerce website selling products.

An important part of your e-commerce website is the shopping cart, this virtual cart keeps track of the products the visitor indicated he/she wants to purchase. If this shopping cart functionality should fail, for whatever reason (bug, code changes, human error, ...) the owner of the website will immediately start losing money and customers.

In an effort to prevent this, we decide to create a functional test with Selenium to verify if the shopping cart is still functioning like it should.

The first thing we need is to download the Selenium IDE addon for Firefox. It will help us in creating our first Selenium test.

The IDE has a function to record your browsing activity. All you need to do is launch the addon, click the record button and start performing actions.

Our first test

In our case, we would click the record button, go to our e-commerce website and click Add to cart on a specific product. We'll then go to the shopping cart page and verify if our product is in the cart. Right click the title of the product in the cart and select verifyTextPresent. This will verify if the product is in fact in our cart.

Stop the recording of the test. Your first Selenium test is ready! You can now choose to run this test in your browser. It will mimic the actions you just performed and verify that the product is in fact in your shopping cart.

We could stop here and run this test manually every time we want to test our shopping cart. But what about other browsers, maybe the cart is broken in Internet Explorer, a browser used by a lot of people.

Run your test on multiple browsers

That's where TestingBot.com shines. You simply add your test to our website, choose which browsers you want to run it on and how many times per day/week/month. We run the tests for you on the browsers you want. If a test should fail, we'll alert you so you know that something is wrong with your shopping cart.

You can then fix the problem without losing visitors and revenue.


We've made a screencast of the above example so you can follow along easily:

TestingBot Logo

Sign up for a Free Trial

Start testing your apps with TestingBot.

No credit card required.

Other Articles


Today we've added support for NodeJS Selenium testing on our Selenium grid. Installation of our plugin is easy by using NPM (Node Package Manager)....

Read more

As mentioned before on this blog, we use a homemade utility to take screenshots of browser windows. Our tool, built in C#, will take a screenshot o...

Read more

TestingBot updates


It's been a busy week on TestingBot, here's what we did this week: Updated our grid from Selenium 2.15 to 2.16, the changelog reads:

Read more

Today we're examining the captureNetworkTraffic selenium command, a little known gem in Selenium's command list. Selenium offers a feature, captu...

Read more

We have just finished optimizing the video recording in our Selenium grid. Implementing this was harder than we thought, so here are some tips on h...

Read more

After some more optimisations in our code and infrastructure we've now reached the point where the average simple test takes 9 seconds. Compared ...

Read more