• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Selenium Tutorial Day 33 - Concepts

Selenium Tutorial Day 33 - Concepts






Total Views
Views on SlideShare
Embed Views



3 Embeds 4

http://www.slideshare.net 2
http://pinterest.com 1
http://www.scoop.it 1



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.


11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    Selenium Tutorial Day 33 - Concepts Selenium Tutorial Day 33 - Concepts Presentation Transcript

    • 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
    • Day Selenium Concepts 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
    • 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.
    • 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.
    • 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).
    • 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
    • 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
    • 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
    • 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.
    • 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
    • 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