Showing posts with label test script. Show all posts
Showing posts with label test script. Show all posts

Wednesday, November 5, 2014

Sample Selenium IDE Test Script by Recording:


We will use the Mercury Tours website as our web application under test. It is an online flight reservation system that contains all the elements we need for this tutorial. Its URL is http://newtours.demoaut.com/ and this will be our Base URL.

NOTE: The site http://newtours.demoaut.com/ at time is down and not available to work on. We have raised this issue with HP

  1. Create a Script by Recording


Let us now create our first test script in Selenium IDE using the most common method – by recording. Afterwards, we shall execute our script using the playback feature.

Step 1:

  • Launch Firefox and Selenium IDE.

  • Type the value for our Base URL: http://newtours.demoaut.com/.

  • Toggle the Record button on (if it is not yet toggled on by default).


1

 

Step 2:

2

 

Step 3:

  • Right-click on any blank space within the page, like on the Mercury Tours logo on the upper left corner. This will bring up the Selenium IDE context menu. Note: Do not click on any hyperlinked objects or images

  • Select the “Show Available Commands” option.

  • Then, select “assertTitle exact:Welcome: Mercury Tours”. This is a command that makes sure that the page title is correct.


3

Step 4:

  • In the “User Name” text box of Mercury Tours, type an invalid username, “invalidUN”.

  • In the “Password” text box, type an invalid password, “invalidPW”.


4 5

Step 5:

  • Click on the “Sign-In” button. Firefox should take you to this page.


6

Step 6:

  • Toggle the record button off to stop recording. Your script should now look like the one shown below.


7

Step 7:

  • Now that we are done with our test script, we shall save it in a test case. In the File menu, select “Save Test Case”. Alternatively, you can simply press Ctrl+S.


8

Step 8:

  • Choose your desired location, and then name the test case as “Invalid_login”.

  • Click the “Save” button.


9

Step 9:

  • Notice that the file was saved as HTML.


10

Step 10:

  • Go back to Selenium IDE and click the Playback button to execute the whole script. Selenium IDE should be able to replicate everything flawlessly


11