Http://docs.seleniumhq.org/download/



krishnatrainingusa@Selenium IDE: addon to FF browser: record and playback featureHow to install this addon: FF must Steps: 1) open FF browser and open 2) type selenium IDE download in the google search filed3) simply click on “downloads page- selenium” it will redirect us to selenium official website downloads page4) inorder to download that selenium IDE addon simply click on the latest version of IDE5) click on allow button and click on install button after successful installation it wil ask us to restart the browser simply restart the browserHow 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 , enter some value in search field and click on search buttonSimply 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 scriptHow 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 scriptsInorder 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 IDEIn the log it will display a detailed information related to test case failure or test case passedOnce 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 caseGoto 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 lastExample: bing_search.htmlUsage 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 cmdWhether 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 objectspyHow can we install firebug ??? : firebug is an addon to ff browser: to identify various properties of an objectSteps: 1) open th browser and open google home page2) in the search field enter firebug addon3) click on “Firebug Addon to Firefox” link among the search results4) Click on “Add to Firefox” and click on install button automatically firebug will be installedWe can add multiple addons to FF browserHow can we verify whether firebug is installed or not???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”At the extreme right top most end of the browser we can see the firebugHow 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 objectWhy 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 addonIs this the only way we can get object properties or do we have some other way???There were 2 ways inorder to get object propertiesWith 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 objectWith 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 addonWith 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 objectHow can we identify an object with the properties disapled in firebug???Generally we can identify any object in webpage with below properties:Id: NameClassLinkText Xpathcsshow can we identify object with above properties???Syntax which we need to implement in IDE:Propertytype=propertyvalueWe can identify an object with any one the above properties..Id we were unable to identify then goto name property, someother propertyPropertytpe:id,class,name,link,,titlePropetyvalue: wecan get it from firebugExample: id= sb_form_q so we need to keep this syntax in targetassume 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 xpathSyntax://element[@propertytype=’propertyvalue’]< input/a/spanexample://input[@type=’submit’]//input[@value=’Log in’]Property type, property value we can get from firebug onlyThen what is this element???<s >Scenario: identify object properties for search text field in How can we use firebugSimply right click on the object for which we want to get the propertiesHow can we identify a link ????Link=linkname We can write xpath for links alsoIdentifying 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’)]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 InterfaceSimple 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 linkUse: inorder to add verification points to our IDE script we are using this context menuWhere 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 cmdsPrecondition: we need to open IDE window 1st then only we can see this context menuToo 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)elementpresentPrefix is changing+suffix remains constantTextpresent,text,title,elementpresentAssert,verify,waitfor,storeTextpresent: 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 commandText: it will verify whether text is there or not in the web page at a particular locationTitle: 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 pageBing selenium bing selenium web browser automationElement 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 objectScenario: assume that webpage was not loaded successfully and evn that text field and search button was not there in the webpageAssert,verify,: the purpose of these two is one and the same: inorder to verify some thing in the web pageAssert: it wil acts like mandatory verification pointVerify: it is not an mandatory verofocation pointwaitfor,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 loginThe verification point after logged into app is “ Krishna Krishna “ text and logout linkDifferences 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 executionVerify: eventhough verification point was not thre in web page it will simply continue remaining cmds executionTitle: we are verifying once after opening the application whether we landed to proper page or not with title as a verification pointLocators: id, name class Link=link nameSoon after we prepared test script we need to add verification point with either assert or verifyWaitfor and store: Store: it will store a value to a variableEx: int a=5 in c language or java language this is not in IDEString 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 case1hr: 45min to 50mins and 25mins to clarify doubtsCommands in IDE??? 10cmds IDE RC alsoFor few cmds it contains cmd, target, value and few cmds cmd , targetLogin 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 creationCreate contact to applicationId,name,class,link,xpath etcPropertytype= propertyvalueVarious kinds of commands in IDE: around 10cmds in IDE if I know those cmds then I can simply work on both IDE and RCVerify, assert, click, clickandwait,type,select,selectandwait,check,uncheck,highlight,goback,refresh,store ,echo and openSignificance 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 verifyVerifytextpresent,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 cmdClickandwait: click+andwaitwhen 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 commandClickandwaitclick+waitforpagetoloadWaitforpagetoload: wait until the web page got loaded or simply stop the selenium IDE script execution until the web page got loadedGenerally 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 separtlyIt will stop selenium IDE script execution untilWaitfortextpresent: it will wait or stop our IDE execution until that text got displayed in the web pageWaitforelementpresent: it will wait or stop our IDE execution until that object got displayed in the web pageWaitfortitle: it will wait or stop our IDE execution until that title got displayed in the webpageWaitfortext: it will wait or stop our IDE execution until that that text wil display in web page at a specific locationHow 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 30secssFor 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 optionsPause: the purpose of pause is similar to waitfor means waitfor and pause are both are one and the sameDifference b/w pause and waitfor cmds:Waitfor: by default selenium IDE will wait for 30secs if the webpage got loaded before 30secs then it will continue remaining cmds executions means it wont stop the script execution for that 30secsExample: 30sec but my app got loaded in 8secs : it wil simply execute remaning cmd executionPause: whatever time we have specified with this cmd this will stop script execution for that time means this cmd was not depending on the default time which is 30secs…..It wil stop the script execution for the specified time but it won’t consider whether the webpage got loaded or notScenario for your practise: prepare selenium IDE script for sugar CRM login krishnatrainingusa@CRM app : “/logout link” instead keeping logout as a verification point assume that I kept some text(abhi) in the web poage which is aa a verification point…We trying to excute our test case but for test case got failed??? Are we confirming that we are not logged into app???Proper verification points and waitfor cmds in SeleniumRefresh: it was similar to the reload button in an webpage means this cmd will simply refresh the current webpageRefreshandwait: it will refresh the webpage and will wait until webpage got reloadedRefreshandwait refresh+waitforpagetoloadUsage of comments in our test script:What is comment , why we are using that and what is the use of that comments??The script wont execute the commentsOnce after we added any comments to our test case it is easy to understand for anyone about that test caseHow can we add comments means???Simply place cursor wherever you want to add comments to out IDE and then select “INSERT NEW COMMENT”How to add commands in middle of test case???Simply place cursor wherever you want to add commands and simply right click and then go for “INSERT NEW COMMAND”Goback: it wil perform similar action like how the goback button is working on the web pageGobackandwait: it will move the page backward and then wil wait until the page got reloadedType: it at all we want to enter something from the keyboard we usually use type cmd or selenium IDE default use type cmd inorder to enter somevalue into any field we usually go for this type cmdSelect: inorder to select a value from the dropdown we use this select cmdSelectandwait: in most of the realtime app we can observe that pnce we select a value from the dropdown automatically the webpage will reload in such cases we usually gofor selectandwait and in remaing cases we will go for select cmdCheck: inorder to check a checkbox we go for this cmdUncheck: inorder to uncheck a checkbox we use this cmdStore: inorder to store a value in a variableInt a=56;Echo: it will print the value which we entered to this cmd into the logOpen: it will open the appOpen base url + absolute URLScenario1:Base url: url: /murthyOpen: : url: simply absolute URL it wont for for base urlCommands which contains command target and value field:Text, ?type ,(Store—comes under different category), selectText: inorder to verify a text at a particular locationCommand: verifyText,AssertText,waitfortext, storetextTarget: the object locator means where we are verifying the text simply “locator”Value: whatever text we are verifying we need to give hereType: inorder to enter something in a fieldCommand:typeTarget: we need to specify where exactly it will perform the type action means simply object locationValue: what value we were supposed to type at that locationSelect: to select a value from the dropdownCommand:selectTarget: the location of that dropdownValue: which value we want to elect from the dropdownStore: to store a value in a variableInt a=5; b=murthyCommand: storeTarget: which value we want to store (5)Value: I which variable we want to store this (a)Syntax in order to get the content present In the variable: ${variablename}Commands which contains command and target:Elementpresent, Textpresent, title,Click, check, uncheck,highlight, open,pauseElementpresent: inorder to verify whether object is there or notCommand: verifyElementPresent, assertElement Present,waitforElementPresent,storeElementPresentTarget: object locationTextpresent: inorder to verify text is there or not in th webpageCommand: verifytextpresent,assert,waitfor,storeTarget: which text we are verifyingTitle: inorder to verify the title of the webpageCommand: verifttilte,assert,waitfor,storeTarget: title of the webpageClick: or clickandwait: to click on search button/or else to perfrm some clickactionCommand: click/clickandwaitTarget:the location where we need to perform clicking actioncheck/uncheck:Command: check/uncheckTarget: object location Open: inorder to open something we are usingOpen=base URL+absolute URLCmd: openTarget:absolute URL and it is optional (“/”)Ex: murthy1234567899: inorder to stop our script execution we usually use this cmdCommand: pauseTarget: how much time we want to stop our scriptHighlight: It will hightlight the object on which it is performing the action means it is similar to that find button in IDECommands which contains only command:Refresh,goback, refreshandwait, gobackandwaitWrite a selenium IDE script to open , enter value in search filed and click on search buttonand finally verify search resultsSteps:OpenEnter some value in search filedClick on the search buttonVerify results Screenshot capturing in IDE: how we are capturing the screenshot with the help of selenium IDE . generally it order to capture any screenshot we usually press “Print screen” button on our keyboard and we used to paste that content in a paintcaptureEntirepagescreenshot: we can capture screenshots in IDEcommand: captureEntirePageScreenshottarget: where we need to save that file and with what name we need to save that file and with what extension(jpeg,png..)example: d://murthy.pngsyntax: driver://filename.extensionvalue: is optinal we no need to specify anything thereoptions in IDE:execution modes in IDE:we can execute entire test case donewe can execute single commands also: simply right click on the command and select execute this commandstart and break points in IDE: instead of executing entire test cas which contains 100 of commands how can we execute only 10 lines of code means 10cmds out of 100 commands simply with the help of start and breakpoints in IDEscenario: we need to execute from 50th to 60thlineif we set start point and break point means our execution will start from start point and will end at the break pointhow can we set a start point???Place our cursor at that 50th line and simply right click and observe whether we can see “Set/Clear start point”.. “s”How can we set a breakpoint??Simply right click on the command and select “Togle break point” “B”If we prepare a test case for and if we try to execute the same test case on how it wil work???Our testcase will fail why because Google: id property : gbqfqBing: id property: sb_form_qHow can we clear start and break points???Whenever we set a set point autoamtiocally if we start execution then the execution will be stared from that start pointHow to stop our script manually???With the help of “Pause/Resume” button we can stop our test case which is besides to “Play Current Test case “ button and by defaultly this button was in disable modeWhen it was enabled???Soon after we started exceuting our test case automatically this pause button wil be enabledHow can we use this pause button and wht is the use of this button???Once after we prepared our test cases on Test environment and whenwe are tyring to execute those test cases in production environmnet if those test cases were failed means we need to use this pause option in order to investigate the root cause behind the failureOne more button “Step by step or step button” which is besides to pause when we click on pause then only step button got enabled.Finally the usage of this step button is wherever you paused the script from tha point it will execute command wise means if I click on step at very1 st time the next cmd will execute after that if any I click on step button the next cmd wil executeLimitations of IDE and how we are overcoming thgose limitations like conditional stmts implementation, multiple window handling, alerts handling , usage of split command, generate dynamic numberLimitations of IDE: 1) it was restricted to FF browser onlyWe cant implement conditional statements in IDESplit cmd usage , generate of dynamic numberMultiple window handling with IDE???Scenario: open , click on testpage for selenium and click on this link opens a popup link so it will display a new window finally perform some action on that newly opened window and after that close the newly opened window and try to work on previous window(1stwindow)..Previous window alsooAs we already closed the newly opened window when I try to perform some actions on our 1st window with out selecting that one it wil through an error message so finally we need to select that With the help of selectwindow command we are slecting newly opend windowsCmd:selectwindowTarget: we need to specify unique property related to that window only (title),, window nameSteps:Open application doneClick on test page for selenium doneClick on this llink opens a popup doneStop our script execution for few seconds with pause cmd doneSelect the newly opened windo with selectwindow command but by default selenium IDE captures some select window simply delete that cmd and try to create a new select window cmd and in the target specify title of the window doneIn the new window click on about link and after our actions we done we can close that window and move back to previous windowScenario 1:Steps:Keep our IDE in recording mode and Open sugar CRM application Enter uid, pswdClick on login buttonClose the existing window Open new window and try to open our application in such case it wont ask credentials again why bcz we already logged into the app with the same browser as the credentials were stored in browser cookiesHow can we handle this situations in IDE???2 optionsDelete the browser cookies = doneWe already have one command in selenium IDE which is deleteallvisiblecookies it contains only command Command:deleteallvisiblecookiesWe can implement simply if conditionSteps:Open applicationBefore entering uid, pswd and click on sign button verify whether logout link got displayed or not???? Means if logout link displayed means simply we can say that we already logged into application.. so print a confirmation msg with exho that we alredy logged into applicationElse enter uid, pswd, and click on signin button and print confirmation msg as successfully logged into applicationOpen sugar crmVerify using if condition whether logoout link is there or not, if logout link displayed simply print already logged into applicationIf logout link displayed simply goto line number 50 or else execute remaining cmdsElse enter uid, pswd, click on sighn in button and print successfully logged into applicationHow come IDE wil identify wth line no????We are creating a label with the same which we have given at if conditionSyntax for if condition: in any programming language is as below:If(logout link displayed){ staring of ifPrint “already logged into app”} ending of ifElse {Enter uid,Enter pswdClick on login buttonPrint “successfully logged into application”}For the above scenario we need to implement if condition where as selenium IDE is not supporting that then how can we handle such situation???As selenium IDE is not supporting if conditions try to write some logic related to if condition in java script code and place it in a fileThe similar way we have identified the limitations of selenium IDE and we wrote some code related to those limitations in java script and we placed all the codes in a single file and we call that file as “user extension file”So when we add this file to our selenium IDE automatically selenium IDE supports if conditions and we ffew more scenariosexample: 200GB , external harddisk . whenever I want information which was ther at external hard disk means we need to connect that external hard disk to our lap so that we can get entire info present in that external hard disk????How can we add this user extension file and from wher we can get this file???I am going to share that file to you How can we add means:Open IDEGoto op-tions and select optionsUnder the general tab We can see selenium core extension(user extension.js) browse optionSimply click on browse and select where exactly that file is and click on ok buttonAfter adding that file simply restart ur IDE To implement if condition selenium IDE wont support if condition by default we are adding this user extension file IDE so that after adding this file it will support after adding this file IDE support various kind so if stmtsIf gotoif if this condtion was true then goto the line number or else skip remaing cmds executionSteps:Open applicationStop the script for few secondsVerify whether logout link is there or not???(gotoif)If you find the logout link after opening the application simply goto line number “already logged into app”else enter uid, pswd, click on signbutton and print confirmation msg as “successfully logged into app”getEval: evaluate or execute the expression given in targetcmd: getEvaltarget: expression which we want to executestoreEval: excute the cmd present in the target and store the results in a variable which was given in the value fieildscenario2: how can we generate a dynamic number and where can we place that dynamic number???whats the use of this dynamic number??? For some scenarios like user creation we need to give a diff number while executing that test case so instead of giving that number directly try to generate one number (which will change based on time) and enter that number in userid placehow can we create multiple contacts using simple if condition??? K1test11Yes we do have we can implement simple if conditionHow can we implement if condition for the above scenario:Steps:We need to know how many users we want to ccreate with the script (10,20,30). 10 users 510,511,512,513,514,515Create a variable x and y.. in “x” store the staring limit and in “y” store the neding limit Assume 50users so x=1,y=10Simply create user means enter value for uid filed and click on save buttonWe need to verify whether x <y if x<y then simply increament x value by 1 and try to create users means gotot step2(user creation)1 selenium1, 1+1=2 2<10 simple move to1st step which user creationGotoif: we need to specify condition and then line noGoto: line no here we are not verifying any conditionGotoif: we need to specify condition and then line noCmd: gotoifTarget: condtionValue: we need to specify line numberGoto: line no here we are not verifying any conditionCmd: gotoTarget: line numberEcho and LOG.warn : to print something in the log why specificall y we are going for log.warn means if there were 100 TCs in my IDe but I want to identify a confirmation msg related to my 10th test case if I go for echo cmd then it will be bit difficult for me to identify that msg from the entire log in such cases we usually prefer this log.warn and we can use any one among these 2..Wait or pause: purpose is same Without user extension file is there any chance for us to implement if condition in IDE???Nooooooooo it contains some code which was written in java scripting where the file contains code releated to gotoif, goto, What is Test suite???Collection of one more test cases and if we save those test cases in an order which we call it as test suite..Example: logint o app and xuser creation test caseSteps:Login to app got failedVerify the user==??Create contact=???Logout from app==??For the entire app if we prepare single test suite what will happen???Geneally we used to prepare test suites for each and every module. Why we are not preparing test suite for entire application means assume there were 6modules in applicationand we prepare signle test suite for all those 6 wchich contains 100 Tcs.. unfortunaly 2module got failed.. so after fixing the issue we need to execute test cases related to 2nd module1st 20 TCs2nd 10TCs3rd 10TCs4th : 205th: 206th: 20Multiple window concept once again: Usage of split cmd : Successfully ccreated user and your uid is “murthy1234”Successfully ccreated user and your uid is “krishna3582”Successfully ccreated user and your uid is “mselenium”So when we are testing this application manually from the application w e can see that uid and we will copy that text and we can login into the app manually??How can I handle this kind of situation with IDE???What we are dong hereWe are copying the entire text from the application and we are storing that text in a variableB= Successfully ccreated user and your uid is :murthy1234:I need to get only murthy1234 or krishna756 or selenium from the entire text ??? how can we get that text??? With the help of split command we can get that textFor the abovr scenario how can we use this split cmd???Split wherever you find spaces B[0]=successfullyB[1]=createdB[2]=userB[3]=andB[4yourB[5]==uidB[6]=isB[7]=”murthy231”Instead of implementing in above why cant we split this at “Split wherever youfind “Successfully ccreated user and your uid is “murthy1234”B[0]= Successfully ccreated user and your uid is “B[1]=murthy2354”We are storing th info into “b”?? how can we store that?? Do we have any cmds???Inorder to store some info present in the browser??? Storecontext menuSyntax: which we need to write in targetJavascript{ storedVars[‘varname’].split(‘delimiter’)[0]}Limitations of IDE: it was restricted to FF onlywe can’t perform data driven testingif we know java script then only we can write our script with desired functionality Selenium RC introduction: execute the prepared test cases in multiple browsers like IE, FF, safari, chrome etc.. multiple browser testing supported heremulti programming language feature support: java, .net, ruby, phyton etcdata driven testing: data from excel bookswe can generate a detailed test execution report : it means how many test cases were executed among which how many were passed and how many were failed and reason for failurewe are writing our codes in java how come those test cases will execute in the browser???programming language(java) selenium serverbrowserselenium server acts like a barrier/bridge between programming language and browserwithout this server we can’t execute our test cases in the browser.Finally selenium server plays a major role in RCSo we are choosing java as a programming language , do we need to know that programming language???No. in our classes wil discuss about few concepts in java which were required for usOOPS conceptsSyntax to write a program in javaVariable declaration Where can we write our test cases in RC???Java as a programming language, whatever test cases we were preparing in RC we are writing those test cases in eclipse editorEclipse is purely java editor then how can we write selenium related commands like open, type, click few more???If we add few files to the eclipse automatically we can write our test cases in eclipseDo we need any kind setup for this selenium RC???Yes, eclipse editor 3.5 or abovewhat are all the files required for us???4 jar filesSelenium server: this is the 1st file required for us and we need to add this file to our eclipse editorSelenium java client drivers: if we add this file to eclipse editor we can implement selenium related commands like open, type, click etc..Jxl : inorder to support data driven testing we need to add this file to eclipseJunit file: to write junit test casesFrom Where we can get these files?? : selenium server urlafter opening this url search for selenium server where we can see “download version 2.31.0” simply click on that link and click on save button automatically it wil be downloaded to our downloads folder: if we scroll down the page we can find “Selenium Client & WebDriver Language Bindings” :under which select java click on the downloads which was relaeted to java link : as it was downloaded as a zip folder try to extract that one Jxl file: the end of the page we cansee save button “jxl/jxl.jar.zip (566k) simply click on that link simply click on save button.Simply right click on that file and click on extract hereJunit.jar file: on download automatically this wil be downloaded to our downloads folderplace all the jar files in a single folder and name that folder as a “library” folderhow we are adding these files to the eclipse editor:open eclipse editor , select the work space and click on ok buttoncreate a new project in eclipse( File >> new >> Java project )right click on the created project >> select build path >> select configure build path >> it wil display a new window >> mocve to the libraries tab >> click on add external jars button >> it wil open a new window rom where u can select all the jar files and simply click on ok button…if we observe in the project a new folder “Referenced Libraries” got created and which contains all the library files present at our library folderfile >> new >> goto other >> expand java folder >> and select java project >> click on next >> give a name >> click on next >> and click on finish buttonintroduction to java:OOPS concepts when we started frameworkMethod: set of commands which we call it as a method.Example: login to app , verify login, logout from app and again login to application and create user and logout from appCode:Login to appVerify useLogout appLogin to appCreate userLogout from appWe are creating a method for login app and where ever it was simply call that method and similarly for logout as wellIf we compare this one with local repository and shared repository in QTPVariable declaration:Dim a=10 this will store a value 10 into variable “a”String uid=”murthy”Int a=5 this will store a value 5 in variable “a”Example: assume we are planning to construct one new house, inorder to construct a house we need a plan(architecture) Class : whatever the plan we are seeing we call it as a classObject: once the house was constructed and we can see that one : any real time entity which we can see is called an object.Basic programming syntax in java:We need to create one class and we can write methods to that class or desired logic to that classHow to create a class in java:Example: write a java code for addition of 2 numbers and store the result in a variable and print that variableClass addition {Int a,b,c; (QTP:Dim a,b,c)A=5;B=10;C=a+b;QTP: ‘msgbox “sum of 2 numbers is” &c”System.out.println(“sum of 2 nos is “, +c);}once we prepared test case in QTP we can simply eceute that test case by pressing “F5”.Inorder to execute the test cases in java the class must contain main methodSyntax:Public static void main (String args[]){Desired code;}The java program execution will start from the main methodLets try to write the above code in eclipse and try to execute that code How to create a class in java:Right click on SRC >> goto new >> and select class >> it wil display new window >> enter name of the class and click on ok buttonHow can we write a simple code in selenium RC in which try to implement few of the selenium IDE commandsScenario: open , enter some value in the search field in selenium RCInorder to open some thing we use open cmd in IDe and inorder to type something we use type command in IDE. How can we use these cmds in eclipse editorHow can we implement selenium related commands in eclipse editor???We have added 4jars to the eclipse editor one among those jar files is “selenium java client drivers”, with the help of this jar file we can implement selenium related cmds in eclipse editor.How to use this file???This selenium java client driver jar file internally contains on class and its name is “DefaultSeleniumClass” that class contains all the selenium related commands.So inorder to use all the selenium related to cmds in eclipse editor simply create an object to defaultselenium class so that we can access all the selenium cmds present within the classHow to create object to default selenium class???Syntax for object creation is some whatdiffer for this defaultselenium classDefaultselenium objname=new DefaultSelenium(p1,p2,p3,p4);Few examples about java classes:Class DefaultSelenium{Public static void main(string args[]){open();type();select();}}}Assume in another class(class B) also I need to use this sum method so instead of writing the sum method in another class try to call the created method which was in class A.How to call the method present in one class(class A) to another class(class B)???Try to create an object to the class A in the class B so that we can access all the methods, variables present in the class AClass B{PSVM(){Addition objname=new addtion();Objname.sum();Try to create an object to class ASyntax inorder to create an object isClassname objectname=new classname(); }}Inorder to use all selenium related cmds in eclipse editor we need to create an object to defaultselenium class by passing all the 4 arguments/paremeters and with the help of that objectname we can use all the selenium cmdsDefaultSelenium selenium=new DefaultSelenium(p1,p2,p3,p4);With the help of these parameters we were specifying on which browser we want to excute this test case and on which application we are executing this test case and on which machine we are executing this test caseP1: we need to specify on which machine we are executing this test case means if we are executing test cases in our own machine then we need to pass this p1 as “localhost” , remote machine then we need to enter that remote machine nameP2: on which port our selenium server is running : 4444P3: specify the browser (IE, FF, chrome,safari)P4: we need to specify the application URLTry to do the same steps and try to execute that test case?? ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download