Transcription of Selenium Documentation - Harvard University
1 Selenium DocumentationRelease ProjectAugust 26, 2012 CONTENTS1 Note to the Reader Docs Being Revised for Selenium !32 Automation for Web Applications .. Automate or Not to Automate? .. Selenium .. History of The Selenium Project .. s Tool Suite .. Your Selenium Tool .. Browsers and Platforms .. and Extensibility .. s in this Book? .. The Documentation Team Authors Past and Present .. 103 .. the IDE .. the IDE .. Features .. Test Cases .. Test Cases .. Base URL to Run Test Cases in Different Domains .. Commands Selenese .. Syntax .. Test Suites .. Commonly Used Selenium Commands .. Verifying Page Elements .. Assertion or Verification? .. Locating Elements .. Matching Text Patterns .. The AndWait Commands .. The waitFor Commands in AJAX applications .. Sequence of Evaluation and Flow control .
2 Store Commands and Selenium Variables .. JavaScript and Selenese Parameters .. The Selenese Print Command .. Alerts, Popups, and Multiple Windows .. Debugging .. Writing a Test Suite .. User Extensions .. Format .. Executing Selenium -IDE Tests on Different Browsers .. Troubleshooting .. 444 Selenium WebDriver .. Does WebDriver Drive the Browser Compared to Selenium -RC? .. and the Selenium -Server .. Up a Selenium -WebDriver Project .. from Selenium .. the Selenium -WebDriver API by Example .. API Commands and Operations .. Specifics and Tradeoffs .. s Drivers .. Alternative Back-Ends: Mixing WebDriver and RC Technologies .. Running Standalone Selenium Server for use with RemoteDrivers .. Additional Resources .. Next Steps .. 725 WebDriver: Advanced and Implicit Waits.
3 Startup Manipulation .. Your Test Runs .. 816 Selenium 1 ( Selenium RC) .. Selenium RC Works .. Selenese to a Program .. Your Test .. the API .. Results .. Some Spice to Your Tests .. Options .. Specifying the Path to a Specific Browser .. Selenium RC Architecture .. Handling HTTPS and Security Popups .. Supporting Additional Browsers and Browser Configurations .. Troubleshooting Common Problems .. 1117 Test Design Test Design .. of Tests .. Results .. Strategies .. Selenium Calls .. Mapping .. Object Design Pattern .. Driven Testing .. Validation .. 1298 Start .. is Selenium -Grid? .. to Use It .. Selenium -Grid Works With a Hub and Nodes .. Selenium -Grid .. Selenium -Grid .. Hub Configuration .. Node Configuration .. Timing Parameters .. Getting Command-Line Help.
4 Common Errors .. Troubleshooting .. 1369 .. Strategies .. User-Extensions With Selenium -IDE .. User-Extensions With Selenium RC .. 13910 Selenium WebDriver Cheat Role Based Interfaces in Selenium WebDriver .. 14311 How to Install the Android Driver14512 .NET client driver configuration14713 Importing Project into Eclipse using Maven15114 Importing Project into IntelliJ Using Maven15315 Selenium Java Client Driver Configuring Selenium -RC With Eclipse .. Configuring Selenium -RC With Intellij .. 18316 Python Client Driver Configuration18517 Locating Useful XPATH patterns .. Starting to use CSS instead of XPATH .. 18918 Migrating From Selenium RC to Selenium How to Migrate to Selenium WebDriver .. Why Migrate to WebDriver .. Before Starting .. Getting Started .. Next Steps .. Common Problems .. 192ivSelenium Documentation , Release :CONTENTS1 Selenium Documentation , Release TO THE READER DOCS BEINGREVISED FOR Selenium !
5 Hello, and welcome! The Documentation Team would like to welcome you, and to thank you for beinginterested in are currently updating this document for the Selenium means we are currentlywriting and editing new material, and revising old material. While reading, you may experience ty-pos or other minor errors. If so, please be patient with us. Rather than withholding information untilit s finally complete, we are frequently checking-in new writing and revisions as we go. Still, we docheck our facts first and are confident the info we ve submitted is accurate and useful. Still, if youfind an error, particularly in one of our code examples, please let us know. You can create a new issue( ) with Docs Error in the subject have worked very, very hard on this document. And, as just mentioned, we are once again workinghard, on the new revision. Why? We absolutely believe this is the best tool for web-application feel its extensibility and flexibility, along with its tight integration with the browser, is unmatched byavailable proprietary tools.
6 We are very excited to promote Selenium and, hopefully, to expand its usercommunity. In short, we really want to get the word out about believe you will be similarly excited once you understand how Selenium approaches test s quite different from other automation tools. Whether you are brand-new to Selenium , or have beenusing it for awhile, we believe this Documentation will truly help to spread the knowledge around. Wehave aimed our writing so that those completely new to test automation can use this document as astepping stone. However, at the same time we have included a number of advanced, test design topicsthat should be interesting to the experienced software engineer. In both cases we have written the Sel-Docs to help test engineers of all abilities to quickly become productive writing your own Seleniumtests. Experienced users and newbies alike will benefit from our Selenium User s very much for reading. the Selenium Documentation Team3 Selenium Documentation , Release 1.
7 Note to the Reader Docs Being Revised for Selenium ! Test Automation for Web ApplicationsMany, perhaps most, software applications today are written as web-based applications to be run in anInternet browser. The effectiveness of testing these applications varies widely among companies andorganizations. In an era of highly interactive and responsive software processes where many organiza-tions are using some form of Agile methodology, test automation is frequently becoming a requirementfor software projects. Test automation is often the answer. Test automation means using a softwaretool to run repeatable tests against the application to be tested. For regression testing this provides are many advantages to test automation. Most are related to the repeatability of the tests and thespeed at which the tests can be executed. There are a number of commercial and open source toolsavailable for assisting with the development of test automation.
8 Selenium is possibly the most widely-used open source solution. This user s guide will assist both new and experienced Selenium users inlearning effective techniques in building test automation for web user s guide introduces Selenium , teaches its features, and presents commonly used best practicesaccumulated from the Selenium community. Many examples are provided. Also, technical informationon the internal structure of Selenium and recommended uses of Selenium are automation has specific advantages for improving the long-term efficiency of a software team stesting processes. Test automation supports: Frequent regression testing Rapid feedback to developers Virtually unlimited iterations of test case execution Support for Agile and extreme development methodologies Disciplined Documentation of test cases Customized defect reporting Finding defects missed by manual To Automate or Not to Automate?Is automation always advantageous?
9 When should one decide to automate test cases?5 Selenium Documentation , Release isnotalways advantageous to automate test cases. There are times when manual testing may bemore appropriate. For instance, if the application s user interface will change considerably in the nearfuture, then any automation might need to be rewritten anyway. Also, sometimes there simply is notenough time to build test automation. For the short term, manual testing may be more effective. If anapplication has a very tight deadline, there is currently no test automation available, and it s imperativethat the testing get done within that time frame, then manual testing is the best Introducing SeleniumSelenium is a set of different software tools each with a different approach to supporting test Selenium QA Engineers focus on the one or two tools that most meet the needs of their project,however learning all the tools will give you many different options for approaching different test au-tomation problems.
10 The entire suite of tools results in a rich set of testing functions specifically gearedto the needs of testing of web applications of all types. These operations are highly flexible, allowingmany options for locating UI elements and comparing expected test results against actual applicationbehavior. One of Selenium s key features is the support for executing one s tests on multiple Brief History of The Selenium ProjectSelenium first came to life in 2004 when Jason Huggins was testing an internal application at Thought-Works. Being a smart guy, he realized there were better uses of his time than manually stepping throughthe same tests with every change he made. He developed a Javascript library that could drive interac-tions with the page, allowing him to automatically rerun tests against multiple browsers. That libraryeventually became Selenium Core, which underlies all the functionality of Selenium remote control (RC) and Selenium IDE.