Selenium IDE: addon to FF browser: record and playback feature
How to install this addon: FF must
Steps: 1) open FF browser and open google.com
2) type selenium IDE download in the google search filed
3) simply click on “downloads page- selenium” it will redirect us to selenium official website downloads page
4) inorder to download that selenium IDE addon simply click on the latest version of IDE
5) click on allow button and click on install button after successful installation it wil ask us to restart the browser simply restart the browser
How can we check whether that IDE was installed or not???
Under FF browser options and under webdevelopers >>> selenium IDE will display >> simply click on that one it wil open a new window
Perform a simple recording scenario in IDE:
Scenario1: open bing.com, enter some value in search field and click on search button
Simply we can conclude that whatever actions we were performing in FF browser IDE is capturing the scripts.
So finally whatever actions we are perforimg in FF browser for those actions only IDE is going to capture the scripts if at all we are performing some action in other browsers like IE,chrom,safari IDE wont capture or records the script
How can we record a simple script in IDE???
Open IDE window from browser webdevlopers
Verify whether IDE was in recording mode or not ???
At the extreme right end of IDE we can see on red button if that button was in enabled mode then only whatever actions we are performing in browser IDE will capture scripts for those actions. Means if that button was in disable mode and even we perform action in FF browser IDE wont capture scripts
Inorder to capture the scripts with help of IDE we need to check 1st whether that IDE was in recording mode or not…
How can we playback or execute the recorded test case:
With the help of “Play current test case” option in IDE
In the log it will display a detailed information related to test case failure or test case passed
Once after test case got executed by simply looking into the color we can confirm whether our test case got executed successfully(pass means green color) or it was failed(red color)
How can we save the test case and why we need to save test case???
If we wont save the script means whenever it was required we need to record that. Instead of recording each and every time if we save that test case and whenever it was required simply call that test case
Goto file >> select save test case >> it wil display a new window under which select where you want to save that test case with desired name.
Inorder to save any test case in IDE we need to give “.html” extension at last
Example: bing_search.html
Usage of Reference option in IDE???
The objective of this option in IDE is if we place our cursor on any cmd in IDE under reference it will display a detailed information about that cmd means how this cmd wil work and what are the various parameters we need to pass for that cmd
Whether IDE is useful for us in real world???
Yes , cmds we are discussing in IDE al the cmds we are going to discuss in RC as well.
Locators: inorder to identify a object in the web page we are going for this locators concept. Means this concept is similar to objectspy in QTP. The ue of objectspy is we can get various kinds of properties supported for an object. Here for this selenium we are using firebug which is similar to objectspy
How can we install firebug ??? : firebug is an addon to ff browser: to identify various properties of an object
Steps: 1) open th browser and open google home page
2) in the search field enter firebug addon
3) click on “Firebug Addon to Firefox” link among the search results
4) Click on “Add to Firefox” and click on install button automatically firebug will be installed
We can add multiple addons to FF browser
How can we verify whether firebug is installed or not???
1) Simply right click on the browser on an object and in the list of options we can see ”Inspect Element with Firebug” or some time “Inspect Element”
2) At the extreme right top most end of the browser we can see the firebug
How can we see various kinds of object properties???
Simply right click on the object and select “Inspect Element with Firebug” after that a small window wil display within the browser in which few set of cmds were in highlighted mode by simply looking into that we can understand that the highlighted properties were related to our object
Why we are going for this firebug? What is the use of this addon??
Inorder to get various kinds of object properties we usually go for this addon
Is this the only way we can get object properties or do we have some other way???
There were 2 ways inorder to get object properties
1) With simple recording :
Open IDE window keep our IDE recording mode and go to the browser , select the object for which we need to get the properties and perform some actions on that object.
Goto to IDE and in the target it will display as dropdown try to observe the dropdown values.. so finally the dropdown values were the various kinds of properties supported for an object
With simple recording we are getting various properties supported for an object then why we are going for firebug???
We can identify object properties simply with firebug addon
2) With Firbug addon:
Simply right click on the object and select “Inspect Element with Firebug” after that a small window wil display within the browser in which few set of cmds were in highlighted mode by simply looking into that we can understand that the highlighted properties were related to our object
How can we identify an object with the properties disapled in firebug???
Generally we can identify any object in webpage with below properties:
Id:
Name
Class
Link
Text
Xpath
css
how can we identify object with above properties???
Syntax which we need to implement in IDE:
Propertytype=propertyvalue
We can identify an object with any one the above properties..
Id we were unable to identify then goto name property, someother property
Propertytpe:id,class,name,link,,title
Propetyvalue: wecan get it from firebug
Example: id= sb_form_q so we need to keep this syntax in target
assume that in a room there were 10 people we need to identify a single person from that 10 members. We simply know that person name only “murthy”.. if at all there were 3 people with the same name in the room ??? then we are identifying the required person with some other properties like his hight or color or various???
With the default properties if selenium IDE was unable to identify object in webpage what we need to do??? Hpw can we handle these kind of situations???
Xpath: if at all IDE was unable identify object in webpage with default properties then we are going for xpath
Syntax:
//element[@propertytype=’propertyvalue’]
< input/a/span
example:
//input[@type=’submit’]
//input[@value=’Log in’]
Property type, property value we can get from firebug only
Then what is this element???
<s >
Scenario: identify object properties for search text field in bing.com
How can we use firebug
Simply right click on the object for which we want to get the properties
How can we identify a link ????
1) Link=linkname
2) We can write xpath for links also
a) Identifying a link with entire text present on that link
“Mailing List Archive”
Syntax:
//element[contains(text(),’text present on that link’)]
//a[contains(text(),'Test Channel Administrative Interface')]
Steps:
Simply Copy the text present on that link and right click on that link and observer the element in firebug
//a[contains(text(),’ Customer Information Interface’)]
Example:
//a[contains(text(),’ Mailing List Archive’)]
b) Identifying alink with startingtext on the link
“Mailing”
//element[contains(text(),’text present on that link’)]
Syntax:
//element[starts-with(text(),’starting text present on that link’)]
//a[starts-with(text(),’Test’)]
//a[starts-with(text(),’Order’)]
Test Channel Administrative Interface
Simple recording:
Context menu:
What is conextmenu???
Assume we are testing crm app login scenario manually once after entering uid, pswd and clicking on sigin button by simply loking into logout link
Use: inorder to add verification points to our IDE script we are using this context menu
Where can we see this context menu???
Goto browser simply right click on the browser where it is displaying list of options at last we can see “Show All Avilable commands” if we place our cousor there it wil display list of cmds
Precondition: we need to open IDE window 1st then only we can see this context menu
Too many cmds how can we understand those cmds??? In a simple way???
So the context menu was divided into 5sets which is open, assert,verify,waitfor,store
(Assert/verify/waitfor/store)Text present
(Assert/verify/waitfor/store)title
(Assert/verify/waitfor/store)Text
(Assert/verify/waitfor/store)elementpresent
Prefix is changing+suffix remains constant
Textpresent,text,title,elementpresent
Assert,verify,waitfor,store
Textpresent: it wil verify whether some text is there or not in the web page and it won’t consider how many times that text was there in the web page it means if the same text is there around 10 times in the web page it wil simply search for the 1st text and wil pass that command
Text: it will verify whether text is there or not in the web page at a particular location
Title: genereally in real time application wherever the page navigation scenarios were there , there we can keep this title as verification point.. because the title of the web page got changed from page to page
Bing è selenium bing è selenium web browser automation
Element present: it will verify whether an object(link,text field, button) is there or not in the web page … it will simply verify the object but it won’t consider text present on the object
Scenario: assume that webpage was not loaded successfully and evn that text field and search button was not there in the webpage
Assert,verify,: the purpose of these two is one and the same: inorder to verify some thing in the web page
Assert: it wil acts like mandatory verification point
Verify: it is not an mandatory verofocation point
waitfor,store:
Scenario1: usage of verification points: login to sugar crm and verify whether we were loggeg into application or not???
After entering uid, pswd and click on sign inbutton how can we confirm whether we were logged into application or not??? By simply observing the home page after login
The verification point after logged into app is “ Krishna Krishna “ text and logout link
Differences between assert and verify with example????
Assert: if at all the verification point was not there in the web page it will simply stop the execution at that cmd only, and it won’t continue remaining cmds execution
Verify: eventhough verification point was not thre in web page it will simply continue remaining cmds execution
Title: we are verifying once after opening the application whether we landed to proper page or not with title as a verification point
Locators: id, name class
Link=link name
Soon after we prepared test script we need to add verification point with either assert or verify
Waitfor and store:
Store: it will store a value to a variable
Ex: int a=5 in c language or java language this is not in IDE
String b=”murthy”;
Differ???
Thursday : record, all 3 filed , action cmd porpose each cmd, how can I add cmds in middle of my test case and how can I execute from middle of my test case
1hr: 45min to 50mins and 25mins to clarify doubts
1) Commands in IDE??? 10cmds IDE RC also
2) For few cmds it contains cmd, target, value and few cmds cmd , target
1) Login to application: assert logout linkif the logout link displayed in browser means we succesfuly logged into application we can proceed with remaining test cases like user creation
2) Create contact to application
Id,name,class,link,xpath etc
Propertytype= propertyvalue
Various kinds of commands in IDE: around 10cmds in IDE if I know those cmds then I can simply work on both IDE and RC
Verify, assert, click, clickandwait,type,select,selectandwait,check,uncheck,highlight,goback,refresh,store ,echo and open
Significance of each and every cmd: with some examples:
Verify and assert: to verify whether something is in webpage or not.. if the verification point is mandatory then we can go for assert if it is not mandatory then we can go for verify
Verifytextpresent,verifiytitle,verify elementpresent, verfiytext
Click: we are clicking on siginibutton: inorder to perform click action we usually go for this click command means example was: clicking on a search button, or clicking on login button or to click on any link in those cases we use click command.. if there is simple click action then we can go for click cmd
Clickandwait: click+andwaitèwhen can we use this cmd means once after we clicked on any link or button if it is redirecting to next page or the web page is reloading then we can go for clickandwait command
Clickandwaitèclick+waitforpagetoload
Waitforpagetoload: wait until the web page got loaded or simply stop the selenium IDE script execution until the web page got loaded
Generally for most of the applications wherever this page loading scenarios were there selenium IDE defaultly records it as clickandwait cmd…
But for most of the real time application instead of loading the entire webpage some part of the page got reloaded means like a frame ro something else in such situations we can’t use clickandwait cmd directly where we need to use click cmd seperatly and waitfor cmds with separtly with the help of conext menu…
Waitfor: instead of loading the entire webpage some part of the page got reloaded means like a frame ro something else in such situations we can’t use clickandwait cmd directly where we need to use click cmd seperatly and waitfor cmds with separtly
It will stop selenium IDE script execution until
Waitfortextpresent: it will wait or stop our IDE execution until that text got displayed in the web page
Waitforelementpresent: it will wait or stop our IDE execution until that object got displayed in the web page
Waitfortitle: it will wait or stop our IDE execution until that title got displayed in the webpage
Waitfortext: it will wait or stop our IDE execution until that that text wil display in web page at a specific location
How much time IDE will wait or it wil stop the execution??? By defaultly selenium IDE will wait for 30000ms== 30sec means whenever we used waitfor or wait cmds in IDE means it wil wait for 30sec by default
IDE >> goto options tab >> and click on options >> where we can see the default time sout which is 30secss
For some of the real time application the web page wil load after 30secs means assume in my application my webpage is reloading after 60secs then my script wil fail??? Simply enter the value under the options