Book Image

Selenium Testing Tools Cookbook

By : UNMESH GUNDECHA
5 (1)
Book Image

Selenium Testing Tools Cookbook

5 (1)
By: UNMESH GUNDECHA

Overview of this book

This book is an incremental guide that will help you learn and use the advanced features of the Selenium toolset including the WebDriver API in various situations to build a reliable test automation. You start off by setting up the test development environment and gain tips on the advanced locater strategy and the effective use of the Selenium WebDriver API. After that, the use of design patterns such as data - driven tests and PageFactory are demonstrated. You will then be familiarised with extending Selenium WebDriver API by implementing custom tasks and setting up your own distributed environment to run tests in parallel for cross-browser testing. Finally, we give you some tips on integrating Selenium WebDriver with other popular tools and testing mobile applications. By the end of this book, you will have learned enough to solve complex testing issues on your own.
Table of Contents (21 chapters)
Selenium Testing Tools Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Configuring Microsoft Visual Studio for Selenium WebDriver test development


Selenium WebDriver provides .NET bindings to develop Selenium tests with the .NET platform. To use the Selenium WebDriver API along with .NET, you need to refer the Selenium WebDriver libraries to the project. Microsoft Visual Studio being the major IDE used in the .NET world, setting up the Selenium WebDriver support has become easier with NuGet Package Manager (http://nuget.org/).

This recipe explains the process of setting up Selenium WebDriver in Microsoft Visual Studio 2013 using NuGet.

Getting ready

NuGet comes bundled with Microsoft Visual Studio 2012 onwards. However, for Microsoft Visual Studio 2010, you will need to download and install NuGet from http://nuget.codeplex.com.

How to do it...

Let's configure Microsoft Visual Studio 2013 to develop Selenium WebDriver tests using the following steps:

  1. Launch the Microsoft Visual Studio.

  2. Create a new project by selecting File | New | Project from the main menu.

  3. In the New Project dialog box, select Visual C# | Test | Unit Test Project. Name the project as SeleniumCookbook and click on the OK button, as shown in the following screenshot:

  4. Next, add Selenium WebDriver packages using NuGet. Right-click on the SeleniumCookbook solution in Solution Explorer and select Manage NuGet Packages…, as shown in the following screenshot:

  5. On the SeleniumCookbook - Manage NuGet Packages dialog box, select Online and search for the WebDriver package. The search will result in the suggestions shown in the following screenshot:

  6. Select Selenium WebDriver from the list and click on the Install button. Repeat this step for Selenium WebDriver Support Classes. Successful installation will show a green tick mark for both the packages, as shown in the following screenshot:

  7. Close the SeleniumCookbook - Manage NuGet Packages dialog box.

  8. Expand the References tree for the SeleniumCookbook solution in Solution Explorer. References for WebDriver are added to the project as shown in the following screenshot:

  9. The SeleniumCookbook project is ready for test development. You can go on adding new tests as needed.

How it works...

NuGet Package Manager adds the external dependencies to Microsoft Visual Studio projects. It lists all available packages and automatically downloads and configures packages to the project. It also installs dependencies for the selected packages automatically. This saves a lot of effort in configuring the projects initially.