Record Your First Script In Selenium

Here I am going to record script for Google search for the word selenium.

1) Open the Selenium IDE

2) By default selenium window will be open in recording mode. On the selenium IDE pop up type google.com in the url.

3) Once the url is typed and recording is on. (You can click on recording button to make recording on or off)

 4) Now go to the browser and type google.com inside the url.

5) Search for selenium word.

6) Click on any link or do any operations whatever you want.

7) Once you are done wit operations the steps will be recorded in selenium.

8) Click on recording button to stop the recording.

9) Before playing the recording script save the script by clicking on ctrl+s orfile–>save. It will ask any name to save. Give any name and save the script.

10) Make the playing slow so that that playing script will be visible and perfect.

11) Now click on play button to play the recorded script.

And  you are done. Isn’t it interesting????

Now we can check the log file also for each step played in the selenium at the bottom.

 

Here are few things that you should know before moving to the next step-

 Command :

 This is the event that you want to perform in the browser. i.e.-

 open: opens a page using a URL.

 click/clickAndWait: performs a click operation, and optionally waits for a new page to load.

 verifyTitle/assertTitle: verifies an expected page title.

verifyTextPresent: verifies expected text is somewhere on the page.

verifyElementPresent: verifies an expected UI element, as defined by its HTML tag, is present on the page.

verifyText: verifies expected text and its corresponding HTML tag are present on the page.

verifyTable: verifies a table’s expected contents.

waitForPageToLoad: pauses execution until an expected new page loads. Called automatically when clickAndWait is used.

waitForElementPresent: pauses execution until an expected UI element, as defined by its HTML tag, is present on the page.

 Target :

This is the identity or the page of the object that which has to fetch of click. i.e.- If we are clicking on any button or link, while running the script selenium identifies the object identity and perform the operation. So the target locates the element.

Selenium can identifies the element by name or by xpath or by css etc.

The benefit is sometimes if the same element mentioned more than one time the selenium becomes confused that which element has to select. In that case we need the change the target for other element so that selenium could identify the exact element to perform the operation.

Don’t worry in the later part of the selenium I will explain the details so move on concentrate on other features.

 Value:

Value field is used to store the variable or string. Here the value is string “selenium” which we used for search key. In later part I will explain how  to store other values.

 

 

<<Previous      Next >>

 

.