A Bluffer's Guide to Selenium 2 By: Simon Stewart & Anthony Long.

8
A Bluffer's Guide to Selenium 2 By: Simon Stewart & Anthony Long

Transcript of A Bluffer's Guide to Selenium 2 By: Simon Stewart & Anthony Long.

Page 1: A Bluffer's Guide to Selenium 2 By: Simon Stewart & Anthony Long.

A Bluffer's Guide to Selenium 2

By: Simon Stewart & Anthony Long

Page 2: A Bluffer's Guide to Selenium 2 By: Simon Stewart & Anthony Long.

What Is Selenium / Sel 2 / Webdriver

Selenium is a test automation framework that interacts with a browser via javascript.Webdriver is a test automation framework that interacts with the browser directly. Selenium 2 is the merging of the Open Source "selenium" and "webdriver" projects.

The most recent release is Selenium 2.0a4.

It's really rather good.

Page 3: A Bluffer's Guide to Selenium 2 By: Simon Stewart & Anthony Long.

Alphas!?

Alphas - finish "baking" the new APIs• Mostly done

o Need to add the advanced user APIo and handling alerts and prompts

• What's there is stable: we're only adding methods now• Timeline: ~2 months

Betas - Implement all APIs in all supported browsers• Supported browsers?

o Firefox 3-latest, IE 6-latest, Chrome, Android, iPhone • Timeline: Unknown

Release - As beta, but equal support for Python, Ruby, Java and C#

Page 4: A Bluffer's Guide to Selenium 2 By: Simon Stewart & Anthony Long.

How Does It Differ From Selenium 1

Two major differences:• Not trapped in the JS sandbox

o So there's a way to handle "alerts" on window load cleanly.

o Better emulation of user input, such as clicking and typing.

• Cleaner APIo So it's easier to write and maintain code.o Far less confusion about which method to call.

Page 5: A Bluffer's Guide to Selenium 2 By: Simon Stewart & Anthony Long.

Why Change?

• The OSS team are now focusing almost all their effort on Selenium 2

• Better support for IEo Still a huge part of the market

• Support for testing mobile browserso Will form a large part of the market in future

• Buy-in and support from browser manufacturers:o Operao Chrome

• Becoming used by a broader range of OSS projectso Not only Selenium, but also Watiro More eyes and users means bugs detected more quicklyo And fixed more rapidly!

Page 6: A Bluffer's Guide to Selenium 2 By: Simon Stewart & Anthony Long.

How Do I Migrate?

• Download Selenium 2• Drop JARs into CLASSPATH

o Using Selenium 1 tech, but with the new classes available.

• Replace "DefaultSelenium" with "WebDriverBackedSelenium"o An implementation of selenium using the new technologyo Inefficient, but allows a managed migration.

• Migrate code to the new API on an "as needed" basiso Suggestion: when you edit a file using the old API, move

to the new one

Page 7: A Bluffer's Guide to Selenium 2 By: Simon Stewart & Anthony Long.

What's Coming Up?

• Advanced User Interaction API:o Allows you to model "click here, then hold shift, click on

these three elements, release shift, and drag everything over here"

o Will be necessary for complex applicationso Selenium 2.0a5 or 6

• Implicit Waits:o The framework will wait for an element to be present

before continuingo Timeout easy to controlo Preview in Selenium 2.0a4, fully implemented in 2.0a5

• Android support:o Selenium 2.0a5

Page 8: A Bluffer's Guide to Selenium 2 By: Simon Stewart & Anthony Long.

If You're Working on the Selenium Code Itself• Shared JS

o JS is great for querying the DOMo Shared JS functions between all webdrivers and

Selenium 1.xo Dramatically easier to fix issues to do with JS in all

browsers• Simplified Build Grammar

o Hey, it matters to us :)• To build:

o svn checkout http://selenium.googlecode.com/svn/trunk/ selenium-read-only

o rake buildo cd build/