mozilla/Addon-Tests — pull request #237 by bebef1987 (2011-11-22 18:04:25+00:00)
Title: Migrate to WebDriver API

This pull request covers the migration to WebDriver (WD) API.
The main reason for the migration is the WD ability to run automated tests against the mobile version of our site. Also one of the things we gain when moving to WD is the ability to use native events.

Please comment on this pull request if you have questions or find issues in the code that we change.

**Our plan:**

* Everything we have been writing in AMO has been merged directly into the master branch. We created an additional "webdriver" branch in the Addons-tests repository where we have changed the page objects over to the WebDriver syntax.
* In order to maintain velocity, we are not using pull requests with the exception of using one merge the webdriver branch into master [Current step]. Activity can be easily monitored through commits: https://github.com/mozilla/Addon-Tests/commits/webdriver .
* To maintain code quality and communication on the project, we are pair programming.
* New tests or changes have been logged and will be migrated to the webdriver branch manually. They can’t be cherry-picked because the RC/WD syntax differs too much.

**Known issues:**

From the [input migration](https://github.com/mozilla/input-tests/pull/102) pull made by @davehunt we have learned that:

* Native events don’t work on MAC
* Events are not fired when the window is not in focus and eventually those tests will fail
* https://bugzilla.mozilla.org/show_bug.cgi?id=702605
* https://bugzilla.mozilla.org/show_bug.cgi?id=566671
* WD requires element visibility to interact with it

**Summary of typical changes:**

* Removed methods and locators that are no longer needed in WebDriver
* WebDriver behaves differently with hidden elements, enabling is to remove is_element_visible methods from tests and concentrate on validating actual content. We removed many unnecessary test steps.
* Locators changed to WebDriver-style tuples containing the strategy and locator.
* Repeating region objects no longer need a count and singular property. All objects are returned, count is obtained using len, and individual items accessed using lookups.
* Page regions changed to use a root_element and then the region accessed in line with other WebQA webdriver projects.

**Other changes:**

* Removed the wait_for_element_visible, wait_for_element_present from the page object. Now using a combination of explicit and implicit waits.
* Explicit waits added where necessary but kept to a minimum:
`WebDriverWait(self.selenium, 10).until(lambda s: self.is_element_visible(*self._caption_locator))`