Book Image

Mastering Selenium WebDriver

By : Mark Collin
Book Image

Mastering Selenium WebDriver

By: Mark Collin

Overview of this book

<p>Selenium WebDriver, also known as Selenium 2, is a UI automation tool used by software developers and QA engineers to test their web applications on different web browsers. The Selenium WebDriver API is fully object oriented compared with the deprecated Selenium RC. The WebDriver API provides multi-language support and run tests on all the most popular browsers.</p> <p>In this wide and complex World Wide Web era, this book will teach you how to tame it by gaining an in-depth understanding of the Selenium API.</p> <p>This book starts with how to solve the difficult problems that you will undoubtedly come across as you start using Selenium in an enterprise environment, followed by producing the right feedback when failing, and what the common exceptions are, explain them properly (including the root cause) and tell you how to fix them. You will also see the differences between the three available implicit waits and explicit waits, and learn to working with effective page objects.</p> <p>Moving on, the book shows you how to utilize the Advanced User Interactions API, how you can run any JavaScript you need through Selenium, and how to quickly spin up a Selenium Grid using Docker containers.</p> <p>At the end, the book will discuss the upcoming Selenium W3C specification and how it is going to affect the future of Selenium.</p>
Table of Contents (17 chapters)
Mastering Selenium WebDriver
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Running tests against our new Selenium Grid


We now know how to quickly spin up Selenium Grid, but so far, we haven't seen it in action. Let's face it. It's not of much use if we can't use it to run some tests. If you have shut down Selenium Grid, you will need to start it up again:

docker run -d -p 4444:4444 --name selenium-hub selenium/hub:2.45.0
docker run -d --link selenium-hub:hub selenium/node-chrome:2.45.0
docker run -d --link selenium-hub:hub selenium/node-firefox:2.45.0

Next, we are going to reuse the Selenium framework that we built in Chapter 1, Creating a Fast Feedback Loop, and Chapter 2, Producing the Right Feedback When Failing. It already supports connections to Selenium Grid. So, we just need to specify the URL of the grid.

If you are using boot2docker on Windows or OS X, this is going to require a little bit of configuration because we can't connect to localhost to interact with Docker. Instead, we need to use a command to find out the IP address that the boot2docker VM is...