Required Firefox Addons for selenium
Step 1:à selenium IDE
Step 2:à Xpather
Step 3:à Firebug
Once u done with this
Creating Sample Test case using Selenium Ide
Go to Mozilla Firefox browser àToolsà selenium Ide
Go to application and right click on the object to open Xpather
In Mozilla Firefox browser se at the right most bottom to your hand to find firebug
Note: The selenium IDE will work only on Mozilla Firefox browser
For example:
Open Browser and URL as www.newrtours.demoaut.com
Here we have a sample test case for login form.
Go to Tools and open selenium IDE find the path for the action we need to perform.
As shown below
For username
Here ”click “ command to perform action.
This step is the target where to perform an action “//form[@name='home']//input[@name='userName']”
This step tell what is the value need for the particular action “test”
And same steps as abovelogin | ||
store | test | UserName |
echo | Username is ${UserName} | |
type | //form[@name='home']//input[@name='userName'] | ${UserName} |
type | //form[@name='home']//input[@name='password'] | ${UserName} |
click | //form[@name='home']//input[@name='login'] | |
waitForElementPresent | //form[@name='findflight']//input[@name='findFlights'] | |
verifyElementPresent | //form[@name='findflight']//input[@name='findFlights'] | |
click | //form[@name='findflight']//input[@name='tripType'][@value='oneway'] | |
select | //form[@name='findflight']//select[@name='passCount'] | 2 |
select | //form[@name='findflight']//select[@name='fromPort'] | |
select | //form[@name='findflight']//select[@name='fromMonth'] | April |
select | //form[@name='findflight']//select[@name='fromDay'] | 1 |
select | //form[@name='findflight']//select[@name='toPort'] | |
select | //form[@name='findflight']//select[@name='toMonth'] | June |
select | //form[@name='findflight']//select[@name='toDay'] | 7 |
click | //form[@name='findflight']//input[@name='servClass'][@value='First'] | |
select | //form[@name='findflight']//select[@name='airline'] | Blue Skies Airlines |
click | //form[@name='findflight']//input[@name='findFlights'] | |
waitForElementPresent | //img[contains(@src,'mast_selectflight')] | |
click | //form[@name='results']//input[@name='outFlight'][@value='Pangea Airlines$362$274$9:17'] | |
click | //form[@name='results']//input[@name='inFlight'][@value='Pangea Airlines$632$282$16:37'] | |
click | //form[@name='results']//input[@name='reserveFlights'] | |
waitForElementPresent | //img[contains(@src,'mast_book')] | |
store(expression, variableName)
Arguments:
- expression - the value to store
- variableName - the name of a variable in which the result is to be stored.
- echo(message)
- Arguments:
- message - the message to print
- type(locator, value)
- Arguments:
- locator - an element locator
- value - the value to type
- click(locator)
- Arguments:
- locator - an element locator
-
- waitForElementPresent(locator)
- Generated from isElementPresent(locator)
- Arguments:
- locator - an element locator
- Returns:
- true if the element is present, false otherwise
- verifyElementPresent(locator)
- Generated from isElementPresent(locator)
- Arguments:
- locator - an element locator
- Returns:
- true if the element is present, false otherwise
- select(selectLocator, optionLocator)
- Arguments:
- selectLocator - an element locator identifying a drop-down menu
- optionLocator - an option locator (a label by default)
- label=labelPattern: matches options based on their labels, i.e. the visible text. (This is the default.)
- label=regexp:^[Oo]ther
- value=valuePattern: matches options based on their values.
- value=other
- id=id: matches options based on their ids.
- id=option1
- index=index: matches an option based on its index (offset from zero).
- index=2
No comments:
Post a Comment