Selenium Tutorial Day 1-3

Portnov Computer School
Test Automation For Web-Based Applications
Presenter:
Ellie Skobel
Day 1
Recording and Running
Selenium Tests
2
Open Firefox browser
Navigate to
http://hrm.seleniumminutes.com (*1)
 Go to Tools  Selenium IDE (*2)

*1
*2
The Record
button is ON by
default
3



Make sure Record button is ON!
Go to the Browser window
*1
Login using (*2):
The Record
button is ON by
default
Login Name: admin
Password: Password

Click Login button
*2
Login: admin
Password: Password
Then click Login
4



Hold your mouse over “Welcome Admin” text
Right-click and select verifyText
Click logout link
*2
Mouse over
“Welcome Admin”
*1
NOT
verifyTextPresent
Select verifyText
5


Go to Selenium IDE
Click the red button to STOP recording
All your actions are recorded and displayed
sequentially under Command Table Tab
Click here to Stop
recording
6
Test-Case Objective
Ensure Valid User Login
Steps
1) In the login textbox type demo.
2) In the password textbox type demo.
3) Click Submit button
4) Verify that a correct user name is
displayed
5) Logout
Expected Result
1) OrangeHRM index page is loaded
2) Correct username is displayed as
part of the greeting.
“Welcome demo”
We created our first automated test script
Manual Test-Case
Automated Test-Case
7


Make sure the Firefox browser is still open
Go to Selenium IDE and click “Play current
test case” button
Make the test case
playback in slow mode
Click to play
the Test Case
8




If you see all the command line rows turn
Green color, then the test has passed.
Light Green means the code executed
without problems.
Dark Green means the test result of the
command evaluated to true.
If any part of the test failed it will be shown
with Red color.
9

Examine the result of the script.
What went
WRONG???
Time is needed to validate the login information…
The test must WAIT for the next web page to load
before proceeding.
10


Click the 3rd to last row
Modify the command field
◦ Replace “click” with “clickAndWait” command

Re-play the test…
Click
this row
Select
clickAndWait
command
11





At least one Firefox browser window must be
open
Play back every automated test to ensure
expected behavior.
Keep playback in slow mode when you begin
debugging.
Then playback in fast mode to finish
debugging.
Placing Browser window and Selenium IDE
windows side by side is a convenient way of
tracking test execution step by step.
12