Monday, 6 August 2018

Working with Selenium IDE: Part-2


1. Two ways to Generate Script IDE:
a. Scripting using Recording Option
b. Scripting Manually

Ex:
Requirement: Create script manually for "Login Operation" on http://newtours.demoaut.com
uid="mercury"
pwd="mercury"


Ex:
Requirement: Create script manually for "User Registration" in Mercury
tours application


2. Enhancement in the script:
After creation of basic script, we can enhance the script using following commands:
i. Assertion commands
ii. Verify commands
iii. Stored Commands

i. Assertion commands:
Used to verify actual values on AUT against expected values

If assertion command is passed, then only the script would allow to continue
further execution, otherwise it will stop execution

ex: AssertTitle: Is used to verify page title with against the expected value

Ex:
Requirement: Create script to check login functionality with valid data procedure
open url: http://newtours.demoaut.com
enter "mercury" in "Username" edit box
enter "mercury" in "Password" edit box
click on "Signin" button
verify page title using assertion command
click on "Continue" button

ii. Verify commands:
Used to verify actual values on AUT against expected values

Verify Command will allow to continue script execution irrespective of
the current test status (Pass/Fail)

ex: VerifyTitle: To check page title

Ex:
Requirement: Create script to check login functionality with valid data procedure
open url: http://newtours.demoaut.com
enter "mercury" in "Username" edit box
enter "mercury" in "Password" edit box
click on "Signin"
verify page title using verify command
click on "Continue" button


iii. Stored commands:
User to read actual values from AUT during runtime

ex: StoreTitle: To read page title

Note:
echo: Command used to print user message in log section
syntax: echo ${variable}

Ex:
Requirement: Create script to read "Page Title" before and after click on
"Forgot your password?" link in https://login.salesforce.com


Converting script into other languages to support other browsers testing:
---------------------------------------
To execute script on other browsers using selenium WD/RC,
we have to convert the script into required supported languages

NAVIGATION:
Create required script in Selenium IDE
select "Source view" in script editor
"Options" menu
"Format"
select Required language

If the Languages are not available, Go to "Option Menu"
"Options"
Click on "Enable Experimental Features"

Limitations of Selenium IDE:
---------------------------
-It supports only FF and Chrome browsers
-Using loop statements and conditional statements are not possible
-Using TestData in the script is not possible (i.e. parameterization)
-There is no exception handling
-Cannot customize test reports

When can we prefer selenium IDE:
------------------------------
-To check if the application compatible for test automation using selenium (i.e. POC)
-If there are any issues with scripting using any programming languages on WebDriver
-To find webelement attributes/html property values

When can we prefer Selenium WebDriver?
-To automate an entire project
========================================================================


No comments:

Post a Comment