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

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Selenium Tutorial Day 33 - Concepts

2,369

Published on

1 Comment
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total Views
2,369
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
58
Comments
1
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

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

×