Your SlideShare is downloading. ×
  • Like


Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.


Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Advanced Selenium Workshop


The Advanced Selenium Workshop demonstrates how organizations and test teams succeed with Selenium and Open Source Test (OST) technology and methodology as a more affordable and flexible option to the …

The Advanced Selenium Workshop demonstrates how organizations and test teams succeed with Selenium and Open Source Test (OST) technology and methodology as a more affordable and flexible option to the proprietary test vendors. Watch how to:
Use Selenium in Java, Python, Ruby
Data enable Selenium scripts
Selenium target locators for Ajax applications
How To Work with TinyMCE (and other Ajax components) in Selenium
Writing Selenium-based Test Object Libraries

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
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. Advanced Selenium WorkshopFrank Cohen, +01 (408) 871-0122, March 31, 2011
  • 2. Open Source Test AutomationAbout PushToTest‣ Our Mission: We Test, For A More Reliable World‣ Make It Easier To Move From Manual To Automated Testing‣ Support Advanced Testing, including Agile, Load, Integration‣ Open Source Testing (OST) For Everyone2
  • 3. Open Source Test AutomationAgenda‣ Using Selenium in Java, Python, Ruby‣ Data enabling Selenium scripts‣ Selenium target locators for Ajax applications‣ How To Work with TinyMCE (and other Ajax components) in Selenium‣ Writing Selenium-based Test Object Libraries3
  • 4. Open Source Test AutomationSelenium Browser Automation‣ Selenium Core‣ Selenium RC‣ Selenium Grid‣ Selenium IDE‣ Selenium Domain Specific Language (DSL)4
  • 5. Open Source Test AutomationWhat Is Selenium Missing?‣ Selenium Core and RC Require A Browser‣ SeleniumEnablement In Firefox Only, Coding Required To Be Useful, No Data IDE Record‣ Selenium Grid for Functional Testing Only‣ No Reports or Results Analysis‣ No Cloud or Grid Deployment‣ No CI or QC Integration‣ RIA Testing using Ajax, Flex, Flash5
  • 6. Open Source Test AutomationSelenium Language Basics‣ Page Commands‣ Element Commands‣ Validation Commands‣ Assertion Commands‣ Storage Commands6
  • 7. Open Source Test AutomationSelenium Locators‣ Identifiers ‣ loginForm ‣ id=loginForm ‣ name=loginForm‣ XPath (1.0 from W3C, no support of 2.0 and XQuery)‣ Link Locator ‣ link=Continue <a href=”mypage”>Continue</a>‣ DOM APIs ‣ dom=document.getElementById(loginForm)‣ CSS Selectors7 ‣ css=input.required[type="text"]
  • 8. Open Source Test AutomationFun With XPath‣ /html/body/table/tr/td/a -> //table/tr/td/a‣ //div[@id=manage_messages_iterator] ‣ <div id=”manage_messages_iterator”> blah </div>‣ //tr[@class=’SelectedRow’]/td[1] ‣ <table><tr class=”SelectedRow”><td>me 1</td><td>me 2</td></ tr></table>‣ //td[child::text()=’’] ‣ <table><tr><td></td</tr></table>‣ //td[contains(child::text(),’@’)]8
  • 9. Open Source Test AutomationMiscellaneous‣ <a href=”continue.html”>Continue</a> ‣ link=Continue‣ RFC 1738 example ‣
  • 10. Open Source Test AutomationString Pattern Matches‣ glob:pattern ‣ * represents any sequence of characters ‣ ? represents any single character ‣ Matches against the entire string‣ regexp:regexp ‣ Match a string using a regular-expression ‣ Includes JavaScript regular-expressions‣ exact:string ‣ Equals‣ No pattern prefix means use "glob" pattern10
  • 11. Open Source Test AutomationEvent Handling and Ajax‣ Selenium Tests Are Event Oriented ‣ Not Timing Oriented‣ Ajax Web Objects ‣ Complicated Structures ‣ Dynamic Values ‣ Asynchronous Events ‣ No Standards‣ Ajax Example11
  • 12. Open Source Test AutomationFun With JavaScript‣ selenium.type("id", "frank");‣ selenium.type(“id”, “javascript{ new Date().getTime();}”);‣ Class Persistence Within A Page <tr> <td>assertEval</td> <td>myfunc = function ( myfile ) { alert(myfile); return 1 }; 1;</td> <td>1</td> </tr> <tr> <td>assertEval</td> <td>myfunc(&quot;frankolo&quot;)</td> <td>1</td>12 </tr>
  • 13. Open Source Test AutomationLooping And Conditionals‣ Great For Ajax Asynchronous Events <tr> <td>waitForCondition</td> <td>selenium.browserbot.getCurrentWindow().document. getElementById(login_button).disabled == false</td> <td>10000</td> </tr>13
  • 14. Open Source Test AutomationTinyMCE Editor API Access‣ selenium.browserbot.getCurrentWindow(). document.tinyMCE.execCommand (mceInsertContent,false,<b>Hello world!!</b>);14
  • 15. Open Source Test AutomationDistributed Test Deployment Application Under Test TestNode Selenium RC SeleniumHtmlUnit Selenese Table Format Interpreter Selenium API Selenese Test TestMaker Console15
  • 16. Open Source Test AutomationScript Runners ScriptRunner Type Sahi Sahi Test Tool HAR HTTP Archive Designer Script Designer Script Selenium HtmlUnit Browser Selenium RC IE, Firefox, Chrome SoapUI SOAP and REST TestGen4Web Web 1.0 Tests Mozmill Mozilla XUL Tests Unit Tests jUnit TestCase DotNet .NET Tests Visual Basic VB tests16 Command Line Desktop and utils
  • 17. Open Source Test AutomationComponent Approach TestScenario Component Application Log-In Load Test 100 Users 500 Users 1000 Users setUp Data runTest Test Use Case Database Production tearDown Development RDBMS DPL Log-In Database CSV DPL Product Search Component QA Regression Order Product Custom DPL Database Confirm Order Component Load Test Log-Out Database Production17
  • 18. Open Source Test AutomationTestMaker Object Designer‣ Point-and-Click Functional Test Record/Playback‣ Record Tests In IE, Chrome, Firefox, Safari, Opera‣ Automatic Ajax Synchronization‣ Drag-and-Drop Data Driven Testing‣ Creates Selenium, Sahi, and Flex Tests Demo18
  • 19. Open Source Test Automation Next let’s talk about Performance Anxiety ‣ The Perfect Storm: IE 7, Selenium, Appcelerator ‣ Mitigation Research Prepared By Luis Carlos Lara, llara@pushtotest.com19 William Martinez,
  • 20. Open Source Test AutomationThe Problem 30 s Ajax App, Selenium RC, TestMaker, Firefox 3 30 m Ajax App, Selenium RC, TestMaker, Internet Explorer 720
  • 21. Open Source Test AutomationHow Bad?‣ The IE 7 JavaScript engine runs up 8-times slower than Firefox 3‣ Appcelerator’s page compiler does not appear to be optimized for IE 7 performance. ‣ We observed 30% performance difference in the way Appcelerator runs text fields between IE 7 and Firefox 3.‣ Some commonly used Selenium functions are not optimized for performance. ‣ We observed a 1798% performance difference by using different Selenium element locator techniques.21
  • 22. Open Source Test AutomationTest 1: No JavaScript‣ Simple (almost no JavaScript) page (Google)‣ The total for IE. of the tests were similar. 3800 ms for Firefox and 4000 ms results22
  • 23. Open Source Test AutomationCaching Impact‣ Firefox Caches JavaScript Objects‣ Repeat for 1 Minute:‣ Plus IE7/Selenium Exceptions (8 times): Permission Denied23
  • 24. Open Source Test AutomationTest 2: Ajax Application‣ Javascript heavy site ‣ Appcelerator’s Calendar sample that ships with PushToTest TestMaker 5.2.324
  • 25. Open Source Test AutomationResource Utilization Firefox 3 IE 725
  • 26. Open Source Test AutomationElement Locator‣ Selenium Type Command using various element locator functions‣ This may be because of: ‣ Slow JavaScript engine in IE. ‣ Selenium not optimized for IE.26 ‣ Slow xpath system engine (if any) in IE.
  • 27. Open Source Test AutomationMitigation‣ Run Selenium RC with IE 7 and expect very long functional test tests ‣ The test will complete eventually. ‣ Do not compare the performance to the same test running on other browsers.‣ Run functional tests using HTMLUnit with an Internet Explorer profile. ‣ Simulates IE functionality while using the faster Rhino JavaScript engine provided in HTMLUnit.‣ Details on PushToTest support for Selenium are found at
  • 28. Open Source Test AutomationBest Practices‣ Build Test Components ‣ Treat your tests as software ‣ Easier to maintain ‣ Resilient to application changes‣ Apply JUnit-style Test Techniques ‣ Set-up, Run-test, Tear-down methods ‣ Write Stateless Test Components ‣ Test puts application into the correct state28
  • 29. Open Source Test AutomationWe Recommend Do Don’t Components Pause Record -> Script Use Static Values Dynamic Locators Storage Values Work With Devs Test and Trash Events Expect The Same29
  • 30. Open Source Test AutomationResources‣‣‣‣‣‣
  • 31. Open Source Test AutomationWhere To Go From Here‣ Please Complete The Evaluation Form ‣ And We Will Send You The Slides‣ Watch A Screencast and Tutorial ‣‣ Attend An Open Source Test Workshop ‣‣ Ask For A Proposal on Licenses, Training, Support, Consulting ‣ Troy Amyett, +01 512-750-8769 (USA, Texas), troy@pushtotest.com31