Selenium is an open source automated testing tool that is used to test web applications. It has several components, including Selenium IDE which is a Firefox extension that allows users to record, edit, and playback tests in the browser. Selenium IDE provides features like record and playback, intelligent field selection, and the ability to save tests in different formats. Selenium tests are made up of actions, accessors, and assertions commands that can be used to automate interactions with a web page like clicking elements, verifying page titles, and asserting text is present. Some commonly used Selenium commands are open, click, assertTitle, and waitForElementPresent.
2. Contents
• What is Selenium
• Selenium Components
• Selenium IDE
• Features of Selenium IDE
• Selenium Commands
• Commonly used Selenium Commands
3. What is Selenium?
• Automated browser-based functional testing tool
• Open Source
• Portable
• Easily Integrated with Other Tools
• Helps in Browser Automation
• Defect Detection
• Multi-Browser
• Multi Programming Language
• Multi Operating System
4. Selenium Components
• Selenium IDE
• Selenium RC
• Selenium WebDriver
• Selenium Grid
• Selenium on Rails
• We’ll go through Selenium IDE and Selenium WebDriver
5. Selenium IDE
• Selenium IDE (SIDE), a functional testing tool, is a complete Integrated
Development Environment (IDE) for Selenium tests (previously known
as Selenium Recorder).
• Firefox extension that allows recording and editing of tests
• Allows easier development of tests
6. Selenium IDE Features
• Record and playback
• Intelligent field selection will use IDs, names, CSS Selector, XPath etc
• Save tests as HTML, Ruby scripts, or other formats
• Support for Selenium user-extensions.js file
• Option to automatically assert the title of every page
7. Selenium Command
• Selenium commands come in three “flavors”:
i. Actions
ii. Accessors
iii. Assertions
• Actions: are commands that generally manipulate the state of applications like Click, Select etc.
• Accessors: examine the state of application and store the results in variables. For example,
storeTitle.
• Assertions: are like accessors but they verify the state of application conforms to what is
expected. “Assert”, “Verify”, and “waitFor” are some examples of Assertion commands.
• Difference between Assert and Verify commands: both serve the same purpose but difference is
that when “assert” fails, the test gets stopped. Whereas, in case of “verify” failure, test will
remains executing while logging the failure.
8. Commonly Used Selenium Commands
• Concluding the introduction of Selenium, we just show you some of the most commonly used commands.
We’ll discuss more about selenium commands in more details in coming tutorials.
• Open: opens a webpage using pageURL.
• Click/ClickAndWait: performs click action and optionally waits for a new web page to load.
• assertTitle/verifyTitle: verify expected web page title.
• assertElementPresent/verifyElementPresent: verify an expected UI element is present on page as defined by
HTML tag.
• assertText/verifyText: verify expected text and all corresponding HTML tag are present on the page or not.
• waitForPageToLoad: this commands pauses the execution unless an expected web page loads completely. This
command called automatically if we use ClickAndWait command.
• waitForElementPresent: this also pauses the execution further unless the expected UI element loads/present
on the page as defined by corresponding HTML tag.