官术网_书友最值得收藏!

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:
    How to do it...
  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:
    How to do it...
  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:
    How to do it...
  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:
    How to do it...
  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:
    How to do it...
  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.

主站蜘蛛池模板: 杂多县| 汉中市| 巴东县| 施甸县| 蕉岭县| 湛江市| 永丰县| 肃北| 小金县| 莱芜市| 赣榆县| 黑河市| 洪湖市| 温泉县| 东至县| 常山县| 仪陇县| 昭平县| 喀喇| 吴桥县| 台北县| 建德市| 镇巴县| 镶黄旗| 云南省| 邯郸县| 台中市| 历史| 陕西省| 永宁县| 临潭县| 广南县| 平阳县| 定结县| 顺平县| 来宾市| 尼勒克县| 漠河县| 余姚市| 虎林市| 抚松县|