Your SlideShare is downloading. ×
Selenium Tutorial Day 33 - Concepts
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Selenium Tutorial Day 33 - Concepts


Published on

1 Comment
  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Selenium Web Test Tool Training Discover the automating power of Selenium Portnov Computer School presents: Presented by: Kangeyan Passoubady (Kangs) Copy Right: 2009-2011, All rights reserved by Kangeyan Passoubady (Kangs). Republishing requires author’s permission
  • 2. Day Selenium Concepts 3
  • 3. Selenium Commands
    • A command is what tells Selenium what to do.
    • Selenium commands are broken down into 3 types:
      • Actions – Command the browser to do something
      • Accessors – Store/retrieve data from selenium variables
      • Asserts – Verify that the browser is in a certain state
  • 4. Selenium Commands - Actions
    • Actions are commands that generally manipulate the state of the application.
    • They do things like "click this link" and "select that option".
    • If an Action fails, or has an error, the execution of the current test is stopped.
    • Many Actions can be called with the "AndWait" suffix, e.g. "clickAndWait".
    • Action 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.
  • 5. Selenium Commands - Accessors
    • Accessors examine the state of the application and store the results in variables, e.g. "storeTitle".
    • They are also used to automatically generate Assertions.
  • 6. Selenium Commands - Assertions
    • 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".
    • All Selenium Assertions can be used in 3 modes: "assert", "verify", and "waitFor".
      • Example include, "assertText","verifyText" and "waitForText".
    • When an "assert" fails, the test is aborted. When a "verify" fails, the test will continue execution, logging the failure.
    • This allows a single "assert" to ensure that the application is on the correct page, followed by a bunch of "verify" assertions to test form field values, labels, etc.
    • "waitFor" commands wait for some condition to become true (which can be useful for testing Ajax applications).
  • 7. Selenium Parameters
    • Two types of Selenium Parameters
      • Locators – Used to find elements in html trees
      • Pattern Matchers – Used to verify values
    • Lots of locator types. Some examples are:
      • Id based,
      • X-Path based, DOM Based
      • CSS selector based
    • Pattern matchers are typically exact matches or regular expressions
  • 8. Selenium Element Locators
    • Element Locators tell Selenium which HTML element a command refers to.
    • Many commands require an Element Locator as the "target" attribute.
      • Examples of Element Locator's include "elementId" and "document.forms[0].element".
      • The format of a locator is: locatorType=argument.
    • To locate elements use identifier, id, name, DOM, CSS, XPath, and link. Without an explicit locator prefix, Selenium uses the following default strategies:
      • DOM, for locators starting with "document.“
      • XPath, for locators starting with "//“
      • identifier, otherwise
  • 9. Selenium Element Filters
    • Element filters can be used with a locator to refine a list of candidate elements.
    • They are currently used only in the 'name' element-locator. Filters look much like locators, i.e.
      • filterType=argument
    • Supported element-filters are:
      • Based on their values match elements. It is useful for refining a list of similarly-named toggle-buttons.
        • value=patternValue
      • Selects a single element based on its position in the list (starting from zero).
        • index=indexValue
  • 10. Selenium String Match Patterns
    • Various Pattern syntaxes are available for matching string values:
      • glob:patternValue: "Glob" is a limited regular expression syntax. Similar to DOS command-line wildcards. In a glob pattern, "*" represents any sequence of characters, and "?" represents any single character. Glob patterns match against the entire string.
      • regexp:regexpValue : Match a string using a regular-expression. The full power of JavaScript regular-expression is available.
      • exact:stringValue : Match a string value exactly, without using any wildcards.
    • If no pattern prefix is specified, Selenium assumes that it's a "glob" pattern.
  • 11. Selenium Recording Problem
    • Why doesn't everything get recorded?
      • Not every event will be recorded by Selenium IDE.
      • Usually the ones that won't be recorded are those that involve complex HTML (Hyper Text Markup Language) and/or AJAX (Asynchronous JavaScript and XML)
      • Careful while testing HTTPS events
  • 12. Selenium Auto Complete Problem
    • Why doesn't event triggered when I select something from auto-complete history?
      • Auto-Complete does not trigger Javascript event
      • No event triggered means Selenium IDE cannot record it
      • Work Around: Manually type the input, instead of selecting it from auto-complete