Recording tests with Selenium

Let us record some tests with Selenium IDE:

Test – 1:

  1. Open the browser and navigate to SugarCRM Login page
  2. Login to application with username – admin and password
  3. Click on Accounts tab
  4. Click on Create Account link
  5. Fill all the necessary fields
  6. Click Save button
  7. Click View Accounts link
  8. Verify the Account created

Selenium Recording

Following are the Selenese commands we recorded in this test:

  1. open
  2. type
  3. clickAndWait
  4. select
  5. verifyTextPresent

Each command does a particular action on the Application Under Test (AUT).  In Selenium IDE, recording table has three columns:  Command, Target, and Value.  As you can see, some of the commands do have Value but all of them have Target.   While recording actions on the AUT, Selenium does record Action, Object, and its Value.  Because to play back the whole test it needs to do the same action whichever recorded during the “recording session”.

In the recorded test for the sixth command “type”, we need to change the value to some other name as it should be unique.

Now, we will try to play back the recorded test.

Yes!! it executed all the commands and created an account.  We have tried recording and running our first test scenario using Selenium IDE.

Note: Please refer to my previous post for Installation of SugarCRM & Selenium IDE

Comments 4

  • Hi Seetaram,
    Your post are really good and effective.
    I am facing two problem.
    Environment :
    Selenium Id 1.3 xpi
    selenium RC server 1.1
    Issue 1:
    I am trying to show Java Script Alert message for wrong entry in my automation script for RC and ID.
    So i recorded some script. Has been recorded proper way but not able to popup alert message .
    type first_name @#@
    click //input[@value=” and @type=’submit’]
    assertAlert First name can only contain characters A-Z, a-z.

    In RC Server
    selenium.type(“first_name”, “@#@”);
    selenium.click(“//input[@value=” and @type=’submit’]”);
    assertEquals(selenium.getAlert(), “First name can only contain characters A-Z, a-z.”);

    Issue2:
    In RC
    Suppose I have 4 text box to test.
    So Under one class(test suit)ABC. I created 4 method A, B, C, D and i want to run all method together. I gave @Test annotation for all method than first A method is running successful other
    Three B, C and D getting fail.
    Please help me out.
    Thanks,
    Ajay

    • Dear Ajay,

      1:
      JavaScript can be used to popup alert messages in Browsers. I don”t think that can be possible within the Java code. If you want to popup any messages inside the java code you can utilize java swings.

      2. I need more information on this issue. Provide me the code you are using to run B,C,& D methods. Otherwise, I will not be able to tell you the reason why these methods are not running.

      — Seetaram

      • Hi Seetaram,
        Thanks for your time.
        According to you. In first problem,
        I can’t show usability popup message when run Selenium RC for wrong entry of data in text box
        Because according to you i have write javascript for each and every case for each and every text
        box.

        Second query is:
        I develop my own framework with the help of
        Selenium RC 1.1 server and client
        Ant
        TestNG
        Junit
        This framework is platform independent and browser independent.
        But now Selenium Web-driver came to in picture with 2.11 version.
        Is there compatible with my framework and if i change server 1.1 RC to 2.11 than
        how to make compatible to my framework. Till now i dint work with Webdriver.
        Third one..
        Is there possible to automate CAPTCHA CODE(Dynamic generate verification number or code) after getting refresh of page, to insert in text box for user validation.

        Waiting for your early reply.
        Thanks
        Ajay

  • Hi Seetaram,

    Thank you so much for your blog and info regarding Selenium.
    I am a beginner in this tool.
    I tried the same above recording , while executing the recorded getting the below error,
    [error] Element css=#shortcuts > span > span > a > span not found, It is not moving forward after this.
    Can you please help me in this.

    Thanks,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.