Book Image

Learning Selenium Testing Tools - Third Edition

Book Image

Learning Selenium Testing Tools - Third Edition

Overview of this book

Table of Contents (22 chapters)
Learning Selenium Testing Tools Third Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

WebDriverBackedSelenium


Unfortunately, we spent a considerable time in the past few years developing Selenium Remote Control tests, and converting them over to the new style of Selenium WebDriver might not be feasible. The WebDriver API is fundamentally different in its design compared to Selenium RC.

With this in mind, the Selenium Core development team has created the WebDriverBackedSelenium object that we can use. This allows us to create our tests with Selenium Remote Control syntax that we already know but have some of the benefits of WebDriver with a very minor change to what you currently have. Refer to the following code example:

String baseUrl = "http://book.theautomatedtester.co.uk";
String remoteControl = "localhost";
Int port = 4444;
String browser = "*firefox";
Selenium selenium = new DefaultSelenium(remoteControl, port ,browser ,baseUrl);
selenium.start();
selenium.open("/");
selenium.click("link=chapter1");
// rest of the test code

We then need to change our tests to the following...