Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.


Gives you the basic idea on How to work with Selenium IDE, RC, GRID and Core.

  • Loggen Sie sich ein, um Kommentare anzuzeigen.


  1. 1. Selenium
  2. 2. Session Covers <ul><li>1. Introduction </li></ul><ul><li>1.1 Selenium Origins </li></ul><ul><li>1.2 Selenium - what is it? </li></ul><ul><li>1.3 Selenium Features </li></ul><ul><li>2. Selenium Variants </li></ul><ul><li>2.1 Selenium IDE </li></ul><ul><li>2.2 Selenium Remote Control </li></ul><ul><li>2.3 Selenium Grid </li></ul><ul><li>2.4 Selenium Core </li></ul><ul><li>3. Selenium Concepts </li></ul><ul><li>4. Installations </li></ul><ul><li>5. How to run selenium Tests </li></ul><ul><li>6. Selenium Framework on windows and Linux </li></ul><ul><li>7. Tools – Firebug. </li></ul>
  3. 3. Selenium Origins <ul><ul><ul><ul><li>Thought work is a global IT outsourcing company which focuses on Agile software development. The company has contributed many open source product and one of the products is called Selenium </li></ul></ul></ul></ul><ul><ul><ul><ul><li>The story of Selenium starts at 2004 in Chicago by Jason Huggins buildings core made as “JavaScript Test Runner”. </li></ul></ul></ul></ul><ul><ul><ul><ul><li>They created this core for the testing of an internal time & expenses application written in (python) </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Selenium is a chemical element in the periodic table that has the symbol Se and atomic number 34. </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Selenium is a key mineral which protects the body from Mercury toxicity. Selenium compounds medicate Mercury poisoning </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Many of Selenium developers knew Mercury tools very well </li></ul></ul></ul></ul>
  4. 4. Selenium – What it is? <ul><li>Selenium is one of the most powerful open source automation tools for web application testing (even we can say acceptance testing for web application). </li></ul><ul><li>Primarily developed in Java Script and browser technologies such as DHTML and Frames and hence supports all the major browsers on all the platforms. </li></ul><ul><ul><ul><ul><li>For example, you can have your automation scripts written for Firefox on Windows and run them on Firefox in Mac. </li></ul></ul></ul></ul><ul><li>In terms of coverage for platform and browser, Selenium is probably one of the best tool available in the market for web applications. </li></ul><ul><li>User can customize the selenium tool based on their requirement (code is available for the user). </li></ul>
  5. 5. Selenium Features <ul><li>Open Source tool for Web applications </li></ul><ul><li>Tests Browser Compatibility and system functionality </li></ul><ul><li>No licensing cost associated with it </li></ul><ul><li>Customize according to our requirements. </li></ul><ul><li>Easy to use: </li></ul><ul><li>a) Test Cases are written in pure HTML </li></ul><ul><li>b) Clean and Impressive User Interface </li></ul><ul><ul><li>For example: The scripts written for Firefox on Windows and run them on Firefox in Mac. </li></ul></ul><ul><li>Selenium supports multi platform and multi browser in terms of coverage. </li></ul>
  6. 6. Selenium vs. QTP <ul><li>Selenium : </li></ul><ul><li>Selenium is Cross Platform Tool. </li></ul><ul><li>Selenium has lot of Language Bindings like C#, Ruby, Java, Python, Perl etc </li></ul><ul><li>Selenium is cost free. </li></ul><ul><li>The default format of testing in Selenium is HTML </li></ul><ul><li>QTP: </li></ul><ul><li>QTP is not a Cross Platform Tool </li></ul><ul><li>QTP supports only VBScript </li></ul><ul><li>QTP is very expensive </li></ul><ul><li>QTP can control other types of applications other than web </li></ul>
  7. 7. Selenium Disadvantages <ul><li>We cannot be assured of any add-ins which would be required if selenium fails to recognize objects. </li></ul><ul><li>Also Support provided for Selenium would be very less ( Incase of QTP, HP provides standard solutions and supports to issues). </li></ul>
  8. 8. Selenium Supported Platforms <ul><li>Windows: </li></ul><ul><ul><li>Internet Explorer 6.0+ </li></ul></ul><ul><ul><li>Firefox 0.8 to 2 </li></ul></ul><ul><ul><li>Seamonkey 1.0 </li></ul></ul><ul><ul><li>Opera 8 </li></ul></ul><ul><li>Mac OS X: </li></ul><ul><ul><li>Safari 1.3+ </li></ul></ul><ul><ul><li>Firefox 0.8 to 1.5 </li></ul></ul><ul><ul><li>Camino 1.0a1 </li></ul></ul><ul><ul><li>Seamonkey 1.0 </li></ul></ul><ul><li>Linux: </li></ul><ul><ul><li>Firefox 0.8 to 2 </li></ul></ul><ul><ul><li>Konqueror </li></ul></ul>
  9. 9. Usage of Selenium <ul><ul><li>Bot mode: Selenium Core </li></ul></ul><ul><ul><li>HTML Tables </li></ul></ul><ul><ul><li>Driven mode: Selenium Remote Control (RC) </li></ul></ul><ul><ul><li>Test cases in language of choice </li></ul></ul><ul><ul><li>Record mode: Selenium IDE </li></ul></ul>
  10. 10. Table or Driver Based <ul><ul><li>Table based approach fine for simple tests. </li></ul></ul><ul><ul><li>No programming required </li></ul></ul><ul><ul><li>Doesn't scale – duplication is a major issue. </li></ul></ul><ul><ul><li>Driver approach better for 'Real' test suite </li></ul></ul><ul><ul><li>Can develop tests in language of choice: </li></ul></ul><ul><ul><li>C#, Java, Ruby, Python, Perl </li></ul></ul><ul><ul><li>Easier data management via DB / Excel </li></ul></ul>
  11. 11. Selenium Variants <ul><li>There are four variants of Selenium, which can be used in isolation or in combination to create complete automation suite for your web applications. </li></ul><ul><ul><li>Selenium IDE </li></ul></ul><ul><ul><li>Selenium Core </li></ul></ul><ul><ul><li>Selenium Remote Control </li></ul></ul><ul><ul><li>Selenium Grid </li></ul></ul>
  12. 12. Selenium IDE <ul><li>Selenium IDE is a Firefox plug in, which includes the entire Selenium Core, allows you to record, play back, edit, and debug tests in browser. </li></ul><ul><li>Selenium IDE is the only flavor of Selenium which allows you to record user actions on browser window. </li></ul><ul><li>It can also record user actions in most of the popular languages like Java, C#, Perl, Ruby etc. This eliminates the need of learning new vendor scripting language. However to run them in an automated fashion you need to use Selenium Remote Control. </li></ul><ul><li>Any way selenium default scripts are html (added JavaScript) and that is the script we are going to use it in selenium IDE. </li></ul><ul><li>The reason for availability of other language is, user can get the scripts for Selenium Remote Control. </li></ul>
  13. 13. Contd..
  14. 14. Selenium IDE Concepts <ul><li>When you look at the table , there are 3 columns </li></ul><ul><li>1. command </li></ul><ul><li>2. target </li></ul><ul><li>3. value </li></ul><ul><li>Command: A command is what tells Selenium what to do. Selenium commands come in </li></ul><ul><li>three flavors: </li></ul><ul><li>-> Actions </li></ul><ul><li>-> Accessors </li></ul><ul><li>-> and Assertions </li></ul><ul><li>Target : Element Locators tell Selenium which HTML element a command refers to. The </li></ul><ul><li>format of a locator is: -> locatorType =argument </li></ul>
  15. 15. Selenium Actions <ul><li>Selenium Actions represent something a user would do </li></ul><ul><li>They are helpful in manipulating state of the application </li></ul><ul><li>Many Actions can be called with the &quot;AndWait&quot; suffix, e.g. &quot;clickAndWait&quot;. This suffix tells Selenium that the action will cause the browser to make a call to the server, and that Selenium should wait for a new page to load. </li></ul><ul><li>Actions generally appear in two forms </li></ul><ul><li>action , actionandWait </li></ul><ul><li>ActionandWait assumes a server call and waits for a longer duration </li></ul><ul><li>Actions are commands that generally manipulate the state of the application. They do things like &quot;click this link&quot; and &quot;select that option&quot;. If an Action fails, or has an error, the execution of the current test is stopped. </li></ul>
  16. 16. Selenium Accessors <ul><li>Accessors examine the state of the application and store the results in variables. </li></ul><ul><li>Parameter and variable declarations range from simple values to java script evaluation techniques. </li></ul><ul><li>Store , storeText and storeValue store values for later access. </li></ul><ul><li>Internally Selenium uses a map called storedVars keyed to the variable names. </li></ul><ul><li>Ex: &quot;storeTitle&quot;. They are also used to automatically generate Assertions. </li></ul>
  17. 17. Selenium Accessors contd.. <ul><li>Store (Value to store, variable name) </li></ul><ul><ul><li>Stores a value into variable </li></ul></ul><ul><ul><li>Constructed using JavaScript evaluation techniques </li></ul></ul><ul><li>The variables can directly be accessed using $(variable name) syntax </li></ul><ul><li>JavaScript can be used to create values, entire parameter values are prefixed with 'javaScript{ with a trailing }‘ </li></ul><ul><li>Examples: </li></ul><ul><li>store(value to store, variable name) </li></ul><ul><li>storeValue(input Locator, variable name) storeText(element Locator, variable name) </li></ul><ul><li>storeAttribute(element Locator@ attribute name, variable name) </li></ul>
  18. 18. Selenium Assertions <ul><li>Allows user to verify state of the application </li></ul><ul><li>All Selenium Assertions can be used in 3 modes </li></ul><ul><li>Assert – Upon failure test is aborted </li></ul><ul><li>Verify – Upon failure error is logged and test continues </li></ul><ul><li>WaitFor – Waits for a conditions truth lines for given timeout </li></ul><ul><li>Assertions are like Accessors, but they verify that the state of the application conforms to what is expected. Examples include “make sure the page title is X” and “verify that this checkbox is checked”. </li></ul><ul><li>Ex: assertText, verifyText and waitForText </li></ul>
  19. 19. Element Locators <ul><li>Element Locator Strategies define how Selenium should recognize a particular class of Objects </li></ul><ul><li>Following are some predefined Locator strategies: </li></ul><ul><li>Id = @Id </li></ul><ul><li>Name = @ name </li></ul><ul><li>Identifier = @Id </li></ul><ul><li>Dom= JavaScript expression </li></ul><ul><li>xpath=XPath expression </li></ul><ul><li>Link= textPattern </li></ul><ul><li>css=cssSelector Index </li></ul>
  20. 20. String Matching Patterns <ul><li>glob:pattern “?” - Represents a single character “*” - Represents a sequence of characters </li></ul><ul><li>regexp:regexp Match a string using regular expressions </li></ul><ul><li>exact:string Match a string exactly, without any wild card stuff </li></ul><ul><li>Default Selenium takes glob </li></ul>
  21. 21. Selenium IDE Features <ul><li>Easy record and playback. </li></ul><ul><li>Debug and set breakpoints. </li></ul><ul><li>Option to automatically assert the title of every page. </li></ul><ul><li>Support for Selenium user-extensions.js file </li></ul>
  22. 22. Selenium Remote Control (SRC) <ul><li>Selenium Remote Control is a test tool that allows you to write automated web application in any programming language (Java, .NET, Perl, Python, and Ruby, PHP) </li></ul><ul><li>Selenium Remote Control provides a Selenium Server, which cans automatically start/stop/control, any supported browser. </li></ul><ul><li>The Selenium Server communicates directly with the browser using AJAX. </li></ul><ul><li>You can send commands directly to the Server using simple HTTP GET/POST requests; </li></ul><ul><li>Finally, the Selenium Server acts as a client-configured HTTP proxy, to stand in between the browser and your website. </li></ul>
  23. 23. Selenium RC
  24. 24. How to Start Selenium Server? <ul><li>The Selenium Server is written in Java, and requires the Java Runtime Environment (JRE) version 1.5.0 or higher in order to start. You may already have it installed. Try running this from the command line: </li></ul><ul><ul><ul><li>java –version </li></ul></ul></ul><ul><li>Once you've got Java installed and ready to go, you can start the Selenium Server from the command line like this: </li></ul><ul><li>Go to /selenium directory/server/ </li></ul><ul><li>Java -jar selenium-server.jar –interactive </li></ul><ul><li>Let's begin by using Selenium Server to open up a browser. If you're on Windows and want to run your Selenium commands using Internet Explorer, try typing this: </li></ul><ul><ul><li>cmd=getNewBrowserSession&1=*iexplore&2=http://www.google.com </li></ul></ul><ul><li>If all goes well, you should see a new browser window starting with the browser of your choice. Back in the Selenium Server command window, you should see the following message: </li></ul><ul><ul><li>Got result: OK, 260113 on session 260113 </li></ul></ul>
  25. 25. Selenium Grid <ul><li>Selenium Grid allows you to run Selenium tests in parallel, cutting down the time required for running acceptance tests to a fraction of the total time it currently takes. </li></ul><ul><li>Selenium Grid runs on top of Selenium Remote Control. </li></ul><ul><li>To run Selenium Grid, you need Ant 1.7+ to be installed on your system. </li></ul>
  26. 26. Selenium Grid
  27. 27. Selenium Core <ul><li>Selenium Core is a Test Tool for web applications. </li></ul><ul><li>Selenium core tests runs directly in a Browser. </li></ul><ul><li>Written in Pure JavaScript and DHTML. </li></ul><ul><li>How to start Selenium Core: </li></ul><ul><li>To use Selenium Core, you need to make it available from the same web server as the application you want to test </li></ul><ul><li>Normally, this is as simple as extracting the Selenium Core zip file into the Document Root, htdocs, or webroot of your webserver. </li></ul><ul><li>Then, try to open the TestRunner.html page on your website, which should be in the core/ directory. </li></ul>
  28. 28. Selenium Framework in windows and Linux. <ul><li>Requirements to setup a Basic Framework </li></ul><ul><ul><li>Java </li></ul></ul><ul><ul><li>Selenium Remote Control </li></ul></ul><ul><ul><li>Selenium IDE(If required) </li></ul></ul><ul><ul><li>Eclipse </li></ul></ul><ul><ul><li>Java and Selenium Remote Control should be up and running. </li></ul></ul><ul><ul><li>Invoking a browser though Selenium script. </li></ul></ul>
  29. 29. Tools - Firebug <ul><li>Firebug integrates with Firefox to put a wealth of web development tools at your fingertips while you browse. </li></ul><ul><li>Firebug makes it simple to find HTML elements buried deep in the page. Once you've found what you're looking for, Firebug gives you a wealth of information, and lets you edit the HTML live. </li></ul><ul><li>In any JavaScript-driven website, HTML elements are constantly being created, removed, and modified. Firebug highlights those changes to the HTML in yellow immediately when they occur. </li></ul>
  30. 30. <ul><li>Questions !!! </li></ul>
  31. 31. References <ul><li>http://seleniumhq.org/ </li></ul><ul><li>www.openqa.org/Selenium </li></ul><ul><li>Thank You </li></ul><ul><ul><li> Kalyan. Ch </li></ul></ul><ul><ul><li> [email_address] </li></ul></ul>