Time for action – converting tests to Selenium WebDriver using WebDriverBackedSelenium - Selenium

Let's take one of our Selenium Remote Control tests and change it to use WebDriver Backed Selenium. This should be a simple change:

  1. Open IDEA and load your example.

  2. Create a new external library for the Selenium binaries. We learnt how to do this in Chapter 3, Overview of Selenium WebDriver.

  3. Add the variable WebDriver driver at the top of your class.

  4. Change your setup() to look like the following:

  5. Change the teardown()to:

  6. Run your tests.

What just happened?

We have seen how with very little change to our tests we have got our old Selenium Remote Control tests working using the new Selenium WebDriver drivers. The WebDriver Backed Selenium object has a mapping of the Selenium Remote Control API to the Selenium WebDriver API.

When the browser starts you will see the WebDriver extension in the bottom right of the browser. When it is processing commands, it will turn red and when it isn't it will be black. It should look like the following screenshot:

There are a few items that are not fully supported by WebDriverBackedSelenium, but hopefully as more and more work is done to the framework these will be less noticeable. This is available to all languages that can communicate with the remote server.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Selenium Topics