Friday, December 14, 2012

How to install Selenium IDE in Firefox?

Follow the seven simple steps to install Selenium IDE in Firefox browser

1. Go to http://seleniumhq.org/download/ in Firefox Browser


2. Click on the Latest version of Selenium IDE download which is showing in the below image


3. After Clicking on the latest version, it asks to Click on Allow button on pop-up for continuing installation


4. After Clicking on Allow button, it displays the list of IDE’s for installation, Choose specific IDE and Click on Install or directly click on Install without selecting from the list for installing IDE's


5. Once installation is finished asked for Restart on pop-up, Click on the button for browser restart


6. Once Firefox restarted, check for existence of Selenium IDE in Tools menu bar


7. Click on the Selenium IDE to start working on IDE.
Now your selenium IDE is ready to Use in Firefox Browser.

Monday, December 10, 2012

Selenium IDE FQA's


1) How to open Selenium IDE in Firefox?
A) Selenium IDE can be opened in two different ways,
  • In side bar from View menu -> Side bar -> Selenium IDE
  • As a pop up window from Tools menu -> Selenium IDE. 
While using Selenium IDE in browser side bar it cannot record user operations in a pop up window opened by application.

2) Is it possible to control speed of execution in Selenium IDE?
A) Yes, it is possible to control the speed of execution in Selenium IDE. In Actions menu there are options like Fastest, Faster, Slowest and Slower, helps to control speed of the execution. Apart from that in IDE provides a slider with Slow and Fast pointers to control the speed of execution.

3) Where do I see the results of Test Execution in Selenium IDE?
A) Selenium IDE displays result of test execution in Log Tab at the bottom of the tool.

4) Where do I see the description of commands used in Selenium IDE?
A) Selenium IDE displays description of used commands in reference tab at the bottom of the tool. The simplest way to see the description of the command which we used is just click on the command, by default Reference tab opens with an explanation of the command which is clicked.

5) Is it possible to Create Test Suite in Selenium IDE?
A) Yes, it is possible to create a test suite in Selenium IDE. You have to create individual test cases and add them to suite. Follow the below steps to create Tes suite in Selenium IDE.
Open Selenium IDE,
  • Select File -> Save Test Case with TestCase1.html Name, Record the test steps and Save
  • Select File -> New Test Case with TestCase2.html Name, Record the test steps and Save
  • Select File -> New Test Case with TestCase3.html Name, Record the test steps and Save
  • Select File -> Save Test Suite and Provide name as ‘Test-Suite’ as Name. Now a new test suite is created with the name Test-Suite. Going forward Click on open Test Suite in file menu to open saved test suite. 
6) Is Selenium IDE contains Check points? What are they?
A) Yes, Selenium IDE contains checkpoints; these are also named as assertions. These checkpoints can be added either during recording or after recording. The checkpoints are classified in three different ways.
  1. Verify: Verify is used for validate expected value on application at specified position with actual value to verify existence. If actual and expect value matches, IDE executes next lines in test cases. If actual and expected are not matching IDE waits till the default timeout (30000 ms) and gives the failure notice and continues execution. For every failure in execution failure count will increase. 
  2. Assert: Assert is used to verify existence of actual value in application from expected information. If actual and expected value is not correct/ mismatches, it gives failure notice and stops executing further lines in the test case. In Log tab, it gives detail information such as what is actual value and what is expected. For every failure in execution failure count will increase.
  3. waitFor: waitFor is also same as verify Command, but the difference between waitFor and verify is, verify can be used for all kinds of controls in the application but most of the waitFor commands are used for Ajax Controls. If waitFor command fails at verification point, execution controller goes to next test case without stopping the execution. For every failure in execution failure count will increase. 
7) How to add checkpoints to my test during recording or after recording?
A) It is very simple to add checkpoints to the test cases during recording
  1. During Recording: At the point where checkpoint need to add go to the application, right click on the mouse and click on show all available commands at the bottom of the right click operations, it will display list of Assert, verify and WaitFor checkpoints, choose the one which you expect at that position and click on it. It adds a line of code in selenium IDE 
  2. After recording: If any checkpoint need to add after recording, place the cursor next to the position line and click on right click from mouse and select “Insert new command” by default a new blank line will add to the code before cursor positioned line. Enter/ select checkpoint name in command list, add target value [target means object which need to verify] and enter expected value in Value. 
8) How do I edit tests in Selenium IDE?
A) It’s very easy to edit tests in IDE. IDE supports two different types of edit modes for modifying existing tests.
  1. Table View: In Table view, we need to click on the line where modification is required, onclick the line; displays the used command, target and value separately in Command, target and value blocks. Rephrase the existing text/command in three different blocks. 
  2. Source View: In this view the test case will be in the format of XHTML, we need to add html code. We has to write one <TR> and three <TD> lines to add a new line in the test case. For editing identify the <TR> row and change the text in between <TD>. 
9) Is there any format to write syntax in IDE?
A) Exactly, we don’t have anything like format to write coding; we need to follow three basic steps to complete a line of code IDE. After entering data in the following blocks, it’s a notification of finished one line code.
  • Name of Command 
  • Element Locator (also known as Target) 
  • Value (required when using echo, wait etc) 
10) What should I write in Target block?
A) In the Target block, we describe object, which helps IDE to identify the object and performs the action according to the command with value.

11) How do we describe object and from where we take description?
A) When ever we are opening any webpage (www.google.com), internet downloads that page code from server and keeps in page source. Page source will be in the form of XHTML format. We dig the page source and take the description of the object. According to the description of the object, IDE go backs to page source and pickups the object while executing
Ex: The following code is Google Search input box
<input id="gbqfq" class="gbqfif" name="q" type="text" autocomplete="off" value="" style="border: none; padding: 0px; margin: 0px; height: auto; width: 100%; background-image: url(data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw%3D%3D); background-color: transparent; position: absolute; z-index: 6; left: 0px; outline: none; background-position: initial initial; background-repeat: initial initial;" dir="ltr" spellcheck="false">
In the above code, we have properties like name, id, class all these are the properties of input box. To write data into Google Search input box, we use id = gbqfq or class = gbqfif or name = q in target block.

12) How many different methods we use to identify object?
A) There are ‘N’ no of ways we recognize object from page source like
  1. Id = idname 
  2. Name = Name of Object 
  3. ClassName = ClassName of Object 
  4. Link = name of Link 
  5. Xpath = location of the object 
  6. Css selector = according to style design 
13) What is XPath? When should I use XPath in Selenium IDE?
A) Xpath stands for Extensive Markup Language path, when even any HTML, XHTML, DHTML or XML is creating or generating, we take help of defined tags (predefined or user defined). We use predefined tags in HTML’s to create web pages and user defined tags to create XML files. HTML or XML, the code will be generated in terms of parent Child format. Whenever we need to identify any object, where the name of the object is not unique, id is temporary, class name is repeating, we took the help of xpath. With of help of Xpath we identify the object based on the nodes.



Examples:
  1. //input[@name= ‘Name Value’] 
  2. //input[@id= ‘ID value’] 
  3. //input[@class= ‘Class Name’] 
  4. //input[contains(@id, ‘Partial Id’)] 
14) What is CSS selector in Selenium?
A) CSS (Cascading Style Sheets) is a language for describing the rendering of HTML and XML documents. CSS uses Selectors for binding style properties to elements in the document. These Selectors can be used by Selenium as another locating strategy.

<html>
<body>
<form id="loginForm">
<input class="required" name="username" type="text" />
<input class="required passfield" name="password" type="password" />
<input name="continue" type="submit" value="Login" />
<input name="continue" type="button" value="Clear" />
</form>
</body>
</html> 

  • css=form#loginForm (3) 
  • css=input[name="username"] (4) 
  • css=input.required[type="text"] (4) 
  • css=input.passfield (5) 
  • css=#loginForm input[type="button"] (4) 
  • css=#loginForm input:nth-child(2) (5) 
15) If Selenium contains too many ways to identify Object? Which method needs to use?
  1. If the object has constant id, we use id method
  2. if the object has constant name, we use name method
  3. if the object has link, we use link name
  4. if the above options are not working, we take help from XPath 
16) Can I handle java script alert using Selenium IDE?
A) We have an option to validate the existence of Alert using verifyAlert /AssertAlert on the page. To perform action on that alert window, we need to use selenium2.

17) During recoding in Selenium IDE, if the Target method recorded with ID. How can change the Target value from ID to Name?
A) Its very simple, click on the line and see the same target info in targer block at the bottom, change the target name form id to Name and change the value accordingly.

18) How do I test my own element locator in IDE?
A) When ever you are writing any new element locator place it in Target block and click on find button next to it. It will highlight that object in application, if it’s not the correct locator it shows error information in log window.

19) What is the scripting language using by Selenium IDE?
A) Selenese is the language which is used by IDE as a scripting language.

20) Is it possible to convert IDE tests into another language tests?
A) Yes, it is possible to convert IDE tests to N-unit, J-unit 3/4, TestNG, Ruby, Phyton2 languages using Export Test Case As in File menu.

21) How do I execute the converted test cases using selenium IDE?
A) No, it’s not possible to execute the converted test cases in selenium IDE, IF you converted test case to java need to use selenium2 with Eclipse, converted to .net need to use VS with selenium2, converted to ruby need to use ruby with selenium. Every conversion has its own separate editors and interfaces for execution

22) If I add a line of code in the middle of the list, how to I test that line without testing from beginning?
A) Its very easy, double click on the line which you had added, If that object is existing on the browser, it performs that task on the application on an instant.

23) Is it possible to start execution from a specific line in IDE?
A) Yes, it is possible to start execution of the IDE test from the specific line. Select the line from where the script needs to start execute, right click on the line and click Set/ Clear Start point. Set and clear works as on and off operations.

24) Is it possible to stop execution of script at specific line in IDE?
A) Yes, it’s possible to stop execution of scripts at specific line, select the line where script need to stop execution, right click on that line and add toggle break point.

25) Can I use both starting and ending points within the script?
A) Yes, we can use both Set/ Clear method and Toggle break method in one test case.

26) Do we have any specific tools, which help to identify element locators easily?
A) Yes, we have an add-on to Firefox named as “Fire path”, which helps you to locate elements easily. But my suggestion is dig the application and create your own element locator.

Friday, November 30, 2012

Selenium General FAQS - I

1) What is Selenium? 
A. Selenium is an API which integrates with Editors like Eclipse, MS Visual Studio etc…, to automate browser based applications. The Integration of selenium Jars and Editor like Eclipse becomes a tool, where people are calling selenium tool for browser base applications. Selenium automation tool which lets you automated operations like – type, click, verify, validate and select a web page. The drawback of selenium is it performs only web based operations.

2) How is Selenium different from commercial browser automation tools?
A. Selenium is a library which is available in a range of languages i.e. java, C#, python, ruby, PHP etc while most commercial tools are limited in their capabilities of being able to use just one language. More over many of those tools have their own proprietary language which is of little use outside the domain of those tools. Most commercial tools focus on record and replay while Selenium emphasis on using Selenium IDE (Selenium record and replay) tool only to get acquainted with Selenium working and then move on to more mature Selenium libraries like Remote control (Selenium 1.0) and Web Driver (Selenium 2.0). Though most commercial tools have built in capabilities of test reporting, error recovery mechanisms and Selenium does not provide any such features by default but given the rich set of languages available with Selenium it very easy to emulate such features.

3) What are the set of tools available with Selenium? 
A. Selenium has four set of tools – Selenium IDE, Selenium 1.0 (Selenium RC), Selenium 2.0 (WebDriver) and Selenium Grid. Selenium Core is another tool but since it is available as part of Selenium IDE as well as Selenium 1.0, it is not used in isolation.

4) Which Selenium Tool should I use? 
A. It entirely boils down to where you stand today in terms of using Selenium. If you are entirely new to Selenium then you should begin with Selenium IDE to learn Selenium location strategies and then move to Selenium 2 as it is the most stable Selenium library and future of Selenium. Use Selenium Grid when you want to distribute your test across multiple devices. If you are already using Selenium 1.0 than you should begin to migrate your test scripts to Selenium 2.0

5) What is Selenium IDE? 
A. Selenium IDE is a Firefox plug-in which is (by and large) used to record and replay test is Firefox browser. Selenium IDE can be used only with Firefox browser.

6) Which language is used in Selenium IDE? 
A. Selenium IDE uses html sort of language called SELENESE. Though other languages (java, c#, PHP etc) cannot be used with Selenium IDE, Selenium IDE lets you convert test in these languages so that they could be used with Selenium 1.0 or Selenium 2.0

7) What is Selenium 1.0?
A. Selenium 1.0 or Selenium Remote Control (popularly known as Selenium RC) is library available in wide variety of languages. The primary reason of advent of Selenium RC was incapability of Selenium IDE to execute tests in browser other than Selenium IDE and the programmatical limitations of language Selenese used in Selenium IDE.

8) What is Selenium 2.0? 
A. Selenium 2.0 also known as WebDriver is the latest offering of Selenium.
It provides
              • better API than Selenium 1.0
              • does not suffer from java script security restriction which Selenium 1.0
              • does supports more UI complicated UI operations like drag and drop

 9) What are the element locators available with Selenium which could be used to locate elements on web page? 
A. There are mainly 4 locators used with Selenium –
         • Html id
         • Html name
         • XPath locator and
         • Css locators
         • Class Name

 10) What is Selenium Grid? 
A. Selenium grid lets you distribute your tests on multiple machines and all of them at the same time. Hence you can execute test on IE on Windows and Safari on Mac machine using the same test script (well, almost always). This greatly helps in reducing the time of test execution and provides quick feedback to stack holders.