Wednesday, November 5, 2014
On 7:04 AM by Unknown in Sample Selenium IDE Test Script Manually No comments
Sample Selenium IDE Test Script Manually:
Now, we shall recreate the same test case manually, by typing in the commands. This time, we will need to use Firebug.
Step 1:
- Open Firefox and Selenium IDE.
- Type the base URL (http://newtours.demoaut.com/).
- The record button should be OFF.
Step 2:
Step 3:
- Navigate Firefox to our base URL and activate Firebug
- In the Selenium IDE Editor pane, select the second line (the line below the “open” command) and create the second command by typing “assertTitle” on the Command box.
- Feel free to use the autocomplete feature.
Step 4:
- In Firebug, expand the <head> tag to display the <title> tag.
- Click on the value of the <title> tag (which is “Welcome: Mercury Tours”) and paste it onto the Target field in the Editor.
Step 5:
- To create the third command, click on the third blank line in the Editor and key-in “type” on the Command text box.
- In Firebug, click on the “Inspect” button.
Click on the User Name text box. Notice that Firebug automatically shows you the HTML code for that element.

Step 6:
- Notice that the User Name text box does not have an ID, but it has a NAME attribute. We shall, therefore, use its NAME as the locator. Copy the NAME value and paste it onto the Target field in Selenium IDE.

- Still in the Target text box, prefix “userName” with “name=”, indicating that Selenium IDE should target an element whose NAME attribute is “userName.”

- Type “invalidUN” in the Value text box of Selenium IDE. Your test script should now look like the image below. We are done with the third command. Note: Instead of invalidUN , you may enter any other text string. But Selenium IDE is case sensitive and you type values/attributes exactly like in application.

Step 7:
- To create the fourth command, key-in “type” on the Command text box.
- Again, use Firebug’s “Inspect” button to get the locator for the “Password” text box.

- Paste the NAME attribute (“password”) onto the Target field and prefix it with “name=”
- Type “invalidPW” in the Value field in Selenium IDE. Your test script should now look like the image below.

Step 8:
- For the fifth command, type “clickAndWait” on the Command text box in Selenium IDE.
- Use Firebug’s “Inspect” button to get the locator for the “Sign In” button.

- Paste the value of the NAME attribute (“login”) onto the Target text box and prefix it with “name=”.
Your test script should now look like the image below.

Step 9:
- Save the test case in the same way as we did in the previous section.
Using the Find Button
The Find button in Selenium IDE is used to verify if what we had put in the Target text box is indeed the correct UI element.
Let us use the Invalid_login test case that we created in the previous sections. Click on any command with a Target entry, say, the third command.
Click on the Find button. Notice that the User Name text box within the Mercury Tours page becomes highlighted for a second.
This indicates that Selenium IDE was able to detect and access the expected element correctly. If the Find button highlighted a different element or no element at all, then there must be something wrong with your script.
Execute Command
This allows you to execute any single command without running the whole test case. Just click on the line you wish to execute and then either click on “Actions > Execute this command” from the menu bar or simply press “X” on your keyboard.
Step 1: Make sure that your browser is on the Mercury Tours homepage. Click on the command you wish to execute. In this example, click on the “type | userName | invalidUN” line.

Step 2: Press “X” on your keyboard.
Step 3: Observe that the text box for username becomes populated with the text “invalidUN”
Executing commands this way is highly dependent on the page that Firefox is currently displaying. This means that if you try the example above with the Google homepage displayed instead of Mercury Tours’ then your step will fail because there is no text box with a “userName” attribute within Google’s homepage.
Start point
A start point is an indicator that tells Selenium IDE which line the execution will start. Its shortcut key is “S”.
In the example above, playback will start on the third line (type | password | invalidPW). You can only have one start point in a single test script.
Start point is similar to Execute Command in such that they are dependent on the currently displayed page. The start point will fail if you are on the wrong page.
Breakpoints
Breakpoints are indicators that tell Selenium IDE where to automatically pause the test. The shortcut key is “B”.

The yellow highlight means that the current step is pending. This proves that Selenium IDE has paused execution on that step. You can have multiple breakpoints in one test case.
Step
It allows you to execute succeeding commands one at a time after pausing the test case. Let us use the scenario in the previous section “Breakpoints.”
Subscribe to:
Post Comments (Atom)
Search
Popular Posts
-
Sample Selenium IDE Test Script by Recording: We will use the Mercury Tours website as our web application under test. It is an online flig...
-
Locating GUI Elements Locating elements in WebDriver is done by using the “findElement(By. locator ())” method. The “locator” part of the co...
-
Answer 75 : If you want to see all options available while starting Selenium server then you should use option “-h” while starting Seleni...
-
Answer 60 : While using java you need to create instance of DefaultSelenium class and pass it four parameters – selenium = ne...
-
Answer 51 : Selenium RC is an offering from SeleniumHQ which tries to overcome following draw backs of Selenium IDE – Able to execute...
-
Answer 54 : Selenium core is the core JS engine of Selenium which executes tests on browser, but because of same origin policy it needs t...
-
Answer 18 : You need to use context menu to add check points to your Selenium IDE tests Answer 19 : There are two ways to edit tests...
-
Answer 15 : Yes, you can first record individual test cases and then group all of them in a test suite. Following this entire test suite ...
-
Answer 38 : You could XPath checker - https://addons.mozilla.org/en-US/firefox/addon/xpath-checker/ to test you XPath locators and Fi...
-
Answer 44 : You can change default behavior of Selenium IDE > element locator preference by crating JS file with following– Locato...
Shaik. Powered by Blogger.
0 comments:
Post a Comment