using selenium 3 0

28
USING SELENIUM 3 SIMON STEWART (@SHS96C) SELENIUM PROJECT LEAD

Upload: test-huddle

Post on 08-Jan-2017

2.850 views

Category:

Software


0 download

TRANSCRIPT

USING SELENIUM 3SIMON STEWART (@SHS96C) SELENIUM PROJECT LEAD

SELENIUM 3

A BRIEF HISTORY OF TIME: SELENIUM 1

Core WebDriver W3C WebDriver

1.0

2.0

3.0

SELENIUM 3

A BRIEF HISTORY OF TIME: SELENIUM 2

Core WebDriver W3C WebDriver

1.0

2.0

3.0

SELENIUM 3

A BRIEF HISTORY OF THE FUTURE: SELENIUM 3

Core WebDriver W3C WebDriver

1.0

2.0

3.0

YOUR EXISTING INVESTMENT IN TESTS IS AN IMPORTANT ASSET TO YOU AND YOUR COMPANY

Me. Just now.

SELENIUM 3

WHEN WILL SELENIUM 3 SHIP?

“SOON”

SELENIUM 3

EXAMPLE SELENIUM TEST

SELENIUM 3

UPGRADING: WEBDRIVER USERS

▸ Remove references to deprecated classes

▸ Drop in the 3.0 jar

SELENIUM 3

EXAMPLE SELENIUM TEST

SELENIUM 3

EXAMPLE SELENIUM TEST

SELENIUM 3

UPGRADING: MOST GRID USERS

▸ Drop in the 3.0 jar

https://flic.kr/p/4Hm9Hr

SELENIUM 3

UPGRADING: RC USERS

▸ Run your tests using the WebDriverBackedSelenium

▸ Fix your tests

▸ Drop in the 3.0 jar

▸ Add a reference to the “leg-rc” jar

▸ Migrate to the WebDriver APIs

▸ SeConf 2013 Closing Keynote by Jason Leyba

▸ https://www.youtube.com/watch?v=cSLmfegT36A

SELENIUM 3

EXAMPLE RC TEST

SELENIUM 3

EXAMPLE RC TEST

SELENIUM 3

EXAMPLE RC TEST

SELENIUM 3

UNSUPPORTED SELENIUM RC FEATURES

▸ Using the server as a proxy

▸ Use browsermob-proxy or similar

▸ Adding custom request headers

▸ Because Selenium isn’t an HTTP proxy

▸ Browser side-logs

▸ Replaced by logging in each of the drivers

SELENIUM 3

UPGRADING: IDE USERS

▸ Download the new selenium-html-runner.jar

▸ Use that instead of selenium-server.jar

▸ Run your tests

SELENIUM 3

MISSING IDE FEATURES

▸ Rollups

▸ Coming, but not implemented yet

▸ JS Extensions are handled as best as possible

▸ Loaded per-page, so may act differently

▸ Alert and Prompt handling may be odd

▸ Consider switching to Selenium Builder (http://seleniumbuilder.github.io/se-builder/) or writing code

SELENIUM 3

WHY DO WE NEED A W3C SPEC

▸ Browsers are fearsomely complex beasts

▸ Decouple selenium releases from browser updates

https://flic.kr/p/7VHwy6

SELENIUM 3

THE W3C SPEC AND YOU

▸ Vision: The browser vendors own the driver

▸ Yes, this may mean another binary on your system

▸ But that binary is released by the browser vendor

▸ Tracks changes in the browser

▸ Decouples selenium releases from browser release schedules

SELENIUM 3

THE CHROME AND EDGE DRIVERS

▸ Made by Google and Microsoft

▸ Try them out!

▸ You probably already use them :)

SELENIUM 3

GECKODRIVER: NEXT GEN FIREFOX SUPPORT

▸ Download:

▸ https://github.com/mozilla/geckodriver/releases

▸ Mozilla have changed the architecture of Firefox

▸ 2.x and 3.x users must use the geckodriver for Firefox 48+

▸ Use ESR release (for now) to continue using the original FirefoxDriver (for now)

▸ geckodriver does not support the Actions API yet.

SELENIUM 3

SAFARIDRIVER

▸ Safari 10+, Apple own the SafariDriver

▸ Selenium project will no longer maintain the OSS SafariDriver once Safari 10 ships

THINGS THE SELENIUM TEAM WISHED YOU KNEW

SELENIUM 3

HOW TIMEOUTS WORK

▸ Implicit timeouts occur in the remote end.

▸ Explicit timeouts occur on the local end.

▸ The team suggestion: avoid using implicit timeouts if possible.

SELENIUM 3

USING XPATH

▸ Depends on the underlying browser’s xpath implementation

▸ Very easy to destroy readability of tests

▸ Only used by testers, and therefore fragile

▸ Suggest using CSS selectors instead

▸ Plus side: advances in JS engines mean that xpath isn’t as slow as it used to be

QUESTIONS IN JUST A BIT….