Recording in Selenium IDE and Generating WebDriver Code

In this article, we are going to learn how to record steps in selenium IDE. We are going to see some basic path as well as some basic command descriptions.
Step 1 : Please Install IDE & Firefox (for reference you may see one of my previous posts)
Step 2 : Start Firefox
Step 3 : From menu, click tools, and then select Selenium IDE
Step 4 : By default, when IDE opened, it is recording mode( like , it is recording). In the example I am using this site for practice.
Step 4 : now, From browser go to
Step 5 : You get a static HTML site with 4 tabs “Home”, “Talents”,” Culture”,” Contact”.
Step 6: click on “Home”, then “Talents”,” Culture”,” Contact” accordingly and from stat menu bar, open selenium IDE UI. You will get those 4 steps listed
Step 7: Press stop button from Selenium IDE (right Upper corner Red Round Button)
Now, you have finished recording where steps are simple clicking tabs.
From the IDE, you can work on those steps like re-run.
Now, We will see how to get web driver Unit test codes (Selenium IDE supported some experimental codes)
Step 1 : To get the code, go to Option –> Options… and check the “Enable experimental features” and press ok
Step 2: Now, After recording from IDE, click Options -> Format and get the list below
Step 3: Select c#/NUnit /webDriver ( later on we will also get the JUnit 4 code also) and press OK on warning message( as this is experimental code, so it may be not very accurate).
Now you get the code
In C# Code we have
   1: using System;

   2: using System.Text;

   3: using System.Text.RegularExpressions;

   4: using System.Threading;

   5: using NUnit.Framework;

   6: using OpenQA.Selenium;

   7: using OpenQA.Selenium.Firefox;

   8: using OpenQA.Selenium.Support.UI;


  10: namespace SeleniumTests

  11: {

  12:     [TestFixture]

  13:     public class Untitled

  14:     {

  15:         private IWebDriver driver;

  16:         private StringBuilder verificationErrors;

  17:         private string baseURL;


  19:         [SetUp]

  20:         public void SetupTest()

  21:         {

  22:             driver = new FirefoxDriver();

  23:             baseURL = "";

  24:             verificationErrors = new StringBuilder();

  25:         }


  27:         [TearDown]

  28:         public void TeardownTest()

  29:         {

  30:             try

  31:             {

  32:                 driver.Quit();

  33:             }

  34:             catch (Exception)

  35:             {

  36:                 // Ignore errors if unable to close the browser

  37:             }

  38:             Assert.AreEqual("", verificationErrors.ToString());

  39:         }


  41:         [Test]

  42:         public void TheUntitledTest()

  43:         {

  44:             driver.Navigate().GoToUrl(baseURL + "/");

  45:             driver.FindElement(By.LinkText("Home")).Click();

  46:             driver.FindElement(By.LinkText("Talents")).Click();

  47:             driver.FindElement(By.LinkText("Culture")).Click();

  48:             driver.FindElement(By.LinkText("Contact")).Click();

  49:         }

  50:         private bool IsElementPresent(By by)

  51:         {

  52:             try

  53:             {

  54:                 driver.FindElement(by);

  55:                 return true;

  56:             }

  57:             catch (NoSuchElementException)

  58:             {

  59:                 return false;

  60:             }

  61:         }

  62:     }

  63: }
Step 4 : So, After recording we are getting NUnit code here.
If we make an empty class type project in vs2010(see my previous post on how to create webdriver environment setup) and copy to class to a new empty class, we can run the webDriver Unit test case using NUnit GUI(after building Project)

If we choose the JAVA/JUnit4 webDriver then , we will get the following code

In JAVA code we get
   1: package com.example.tests;


   3: import com.thoughtworks.selenium.Selenium;

   4: import org.openqa.selenium.*;

   5: import org.openqa.selenium.htmlunit.*;

   6: import org.openqa.selenium.firefox.*;

   7: import*;

   8: import*;

   9: import org.junit.*;

  10: import static org.junit.Assert.*;


  12: public class Untitled {


  14:     WebDriver driver;

  15:     Selenium selenium;


  17:     @Before

  18:     public void startSelenium() {

  19:         driver = new FirefoxDriver();

  20:         selenium = new WebDriverBackedSelenium(driver, "");

  21:     }


  23:     @After

  24:     public void stopSelenium() {

  25:         driver.close();

  26:     }


  28:     @Test

  29:     public void testUntitled() {



  32:         selenium.waitForPageToLoad("30000");


  34:         selenium.waitForPageToLoad("30000");


  36:         selenium.waitForPageToLoad("30000");


  38:         selenium.waitForPageToLoad("30000");

  39:     }


  41: }
If we make a JAVA project in Eclipse(see my previous post on how to create webdriver environment setup) and copy to class to a new empty class, we can run the webDriver Unit test case code Running as JUnit 4.0 test project. 

For detail about Selenium IDE, you can visit the link
Thanks for reading this….:)

This is shantonu's personal blog.Mail[] to contact.


  1. Hey, nice site you have here! Keep up the excellent work!


  2. Selenium is really an excellent tool and your information related to selenium recording is really interesting. Also I want to know the latest new techniques which are implemented in selenium. Can you please update it in your website?
    Selenium training Chennai

  3. Hi, this is Yasmin from Chennai. I have read your blog. Its very informative and useful blog. You have done really great job. Keep update your blog. Thanks..
    Selenium Training in Chennai | Selenium Training in Chennai

  4. Hi,
    Your website really useful for beginners. I am new to selenium and i want to learn basic to advanced concepts with real time examples. Can you please help me on this.

    Looking forward for your positive response...!!!


  5. Hi,
    I have read your blog and it really useful for beginners and i am new to selenium and please help me to teach selenium with real time examples .

    Looking forward for your positive response...!!


    1. This was real example when it was created. try to follow same technique for modern sites.