Sunday 20 April 2014

Creating a manual selenium IDE script using firebug

The easiest way for a user to create a test case using the selenium IDE is the record and playback mode. One could record the entire flow with assertions and verifications in between to create the test case. But if one is to move on to learning up the more advanced selenium tools such as selenium RC or web driver, it would be a good practise to manually create the selenium IDE scripts.

For demonstrating this we shall use the http://newtours.demoaut.com/ site to create the IDE script. We shall create a selenese script for a user to login.

STEP1:
  • Launch Firefox browser and selenium IDE.
  • The selenium IDE record button will by default be turned ON. Make sure to toggle this off before starting with test case creation.
  • Set the base URL to http://newtours.demoaut.com/start IDE
STEP 2:
  • Type in the ‘open’ command which would open up the base URL. This will be the first command in our test case.
STEP 3:
  • Open up the http://newtours.demoaut.com/ URL in the Firefox browser.
  • Using firebug we shall try to locate a UI element which can be used as a checkpoint to verify whether we have navigated to the home page. Here we shall use the mercury tours logo image as a check point locator.
    findCHKPOINT_
  • Using either of the locator strategies (here i have used the css locator strategy) for describing the element.
  • Use the ‘verifyElementPresent’ command to verify that the element is present on the page. This way we will be able to verify that we have in fact navigated to the home page itself.
STEP 4:
  • Now we shall try to login. For this we need to inspect the ‘user name’ and ‘password’ fields. We shall do so using firebug as earlier.
    findLoginLoc
  • Using the name locator strategy we can describe these.
  • For typing the user name and password into these text fields we can use the type command.
    LoginIDE
STEP 5:
  • Now for the invalid user to login, we will have to click the ‘sing in’ button. As usual we shall utilize firebug to find out an appropriate locator.
    signinLoc
  • We shall use the ‘clickAndWait’ command for the user to click the sign in button

Our test script is complete now. Save the test case and the completed selenese script will look like the one shown below:

completeScript

5 comments:

  1. Nice basic article about using firebug.People willing to get the indepth knowledge in getting framework such as TestNG,jenkins,Maven and POM should get properly get selenium training in chennai at best selenium training institute in chennai that has other Java specific below trainings.
    Android training in chennai|Java training in chennai with selenium interview questions

    ReplyDelete