The document discusses Selenium 2, which is the next generation of the Selenium web testing tool. Selenium 2 features a cleaner API, support for mobile testing, improved cross-browser testing capabilities, and future-proofing for emerging technologies. It provides examples demonstrating how tests can be more cleanly written in Selenium 2 compared to the older Selenium 1. While rewriting an entire test suite for Selenium 2 may not yet be necessary, its features represent the future of web and mobile application testing.
1 of 20
More Related Content
Boston selenium meetup: Selenium 2
1. Selenium 2
The future of web testing
Tuesday, March 15, 2011
2. Eric Allen
Software Developer, Sauce Labs
@ericpallen
eric@saucelabs.com
? Selenium user for 2+ years
? Selenium contributor
? Developer @ Sauce Labs
? Implemented Selenium 2 for
Sauce OnDemand
Tuesday, March 15, 2011
3. Agenda
? Selenium 2 Overview
? Side-by-side Examples
? Exclusive Selenium 2 Features
? Wrap-up
? Q & A (Get your questions ready!)
Tuesday, March 15, 2011
13. PageFactory
? ? ? ? // Create a new instance of a driver
? ? ? ? WebDriver driver = new HtmlUnitDriver();
? ? ? ? // Navigate to the right place
? ? ? ? driver.get("http://www.google.com/");
? ? ? ? // Create a new instance of the search page class
? ? ? ? // and initialize any WebElement fields in it.
? ? ? ? GoogleSearchPage page = PageFactory.initElements(driver, GoogleSearchPage.class);
? ? ? ? // And now do the search.
? ? ? ? page.searchFor("Cheese");
Tuesday, March 15, 2011
14. User Actions API
(Coming soon!)
More More at http://www.viddler.com/explore/saucelabs/videos/41/
? ?ActionChainsGenerator builder = ((HasInputDevices) driver).actionsBuilder();
? ?Action dragAndDrop = builder.clickAndHold(someElement)
? ? ? ?.moveToElement(otherElement)
? ? ? ?.release(otherElement)
? ? ? ?.build();
? ?dragAndDrop.perform();
Tuesday, March 15, 2011
15. Should I hurry up and re-
write my entire test suite
for Selenium 2?
Tuesday, March 15, 2011
17. Selenium 2:Yes!
? Cleaner, leaner API
? No pesky ¡°server¡± to set up
? Mobile
? Speed
? Improved cross-domain testing
Facebook Connect? Sure!
? Future-proof for modal dialogs
? Alerts
? Authentication
? Certi?cate warnings
? File upload/download
Tuesday, March 15, 2011
18. Selenium 2: No!
? Still pre-release quality
? Works best in Firefox, other browsers
getting there
? Completely different API is spotty
backwards compatibility layer
? No Selenium IDE
? Selenium RC ain¡¯t goin¡¯ anywhere
Tuesday, March 15, 2011
19. Selenium 1: It¡¯s hiding
? ¡°Selenium 2.0b2¡± = Selenium 1 + Selenium 2
? Since 1.0.3...
? Safari CyberVillainsCA
? Nicer error messages
? Sizzle (jQuery) CSS selectors
? Many More!
The Selenium 1 inside Selenium 2.0b2
IS PRODUCTION QUALITY
Tuesday, March 15, 2011
20. More Information
? http://code.google.com/p/selenium/wiki/AdvancedUserInteractions
? http://code.google.com/p/selenium/wiki/PageFactory
? https://github.com/epall/selenium-examples
? http://www.slideshare.net/hugs/selenium-2-webinar-the-next-
generation-of-web-and-mobile-application-testing
? http://www.slideshare.net/davehunt82/from-ide-to-selenium-2
? http://www.slideshare.net/AutomatedTester/selenium-2-the-future-of-
selenium-is-now
Eric Allen
Software Developer, Sauce Labs
@ericpallen
eric@saucelabs.com
Tuesday, March 15, 2011