Today i will show you how to use Selenium IDE to write your first Selenium testing script. If you do not know what is selenium IDE and how to add it into your Firefox web browser, you can read following article first. How To Install Selenium IDE And Firebug In Firefox
You need 3 steps to write selenium testing script use that IDE. That is Record, Play Back and Save.
Record: Record interactions between user and the web browser.
Play Back: Run the recorded selenium testing script to check the test script’s success rate and stability.
Save: When the recorded selenium testing script is stable then save it for future regression test.
Step 1: Record Selenium Testing Script
- Open Firefox, Then Open Selenium IDE. You can click here to know how to open it.
Firefox Menu —> Developer —> Selenium IDE
- Enter www.yahoo.com in the base url input textbox. Make sure the red record button is on (default is on).
- Input the base url into your Firefox url address bar. Then you can begin test case step by step manually. (Do not close the IDE window.) You will see that the IDE will records every action you take in your Firefox web browser. When you complete your test case then all the actions has been recorded.
- You can also right click web page in the Firefox web browser then select and add commands into the test scripts.
- When you add one command you will see the command has been inserted into the test script in IDE window.
- When your test case complete, you should turn the red record button to off state.
Step 2: Play back the recorded selenium testing script.
Now your first automation testing script has been created, you can click playback button to run it.
When your selenium testing script execute, all the successful selenium IDE recorded test steps will highlighted in green color while the failed test steps will highlighted in red color.
Step 3: Save the selenium testing script for later use like regression test.
Click “File —> Save Test Case” in Selenium IDE window to save the selenium testing script into a html format file. When you open the saved file you will see the html content.