This is a generalized guide for configuring Selenium on Windows.
- Create a directory named Selenium under C:\
- Copy the directory downloaded from http://docs.seleniumhq.org/download/ in this example I'm setting up the Java specific package.
- Within IE set all Security Zones to the same protection level
- Add wildcards for your internal domain as exceptions within trusted sites. IE: http://sub.internal.domain.com & https://sub.internal.domain.com (SSL Support)
- Download and Install Resharper from https://www.jetbrains.com/resharper/
- Set the following options in VS for the Resharper Plugin:
Resharper > Options > Tools > Unit Testing > MsTest to use Parallel Test Run Config (Drop-down)
- As this point you should be able to successfully execute WebDriver tests locally from Within Visual Studio. If you don't wish to use Grid: “useGrid = false” within the properties file. If you wish to utilize the Grid continue with the steps below.
- Download and install the JDK suite from: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html. Install everything under C:\Selenium, this should create a jdk directory. You can test the successful installation of jdk by opening CMD Prompt and typing java. This should populate commands.
- Start hub/nodes by double clicking the appropriate .bat scripts located within C:\Selenium. If you don't have the scripts listed you'll need to download the WebDriver for each browser you wish to test in:
Here I'll give a script example for each:
java -jar selenium-server-standalone-2.44.0.jar -role node -hub http://localhost:4444/grid/register -browser "browserName=chrome,maxInstances=3,platform=WINDOWS" -port 5557 -Dwebdriver.chrome.driver="C:\selenium\chromedriver.exe"
java -jar selenium-server-standalone-2.44.0.jar -role node -hub http://localhost:4444/grid/register -browser "browserName=firefox,maxInstances=3,platform=WINDOWS" -port 5558
java -jar selenium-server-standalone-2.44.0.jar -role node -hub http://localhost:4444/grid/register -browser "browserName=internet explorer,maxInstances=1,platform=WINDOWS" -port 5556 -Dwebdriver.ie.driver="C:\selenium\IEDriverServer.exe"
Each of these scripts above should be in your selenium directory with the appropriate executable.
- Test Selenium by opening up the Selenium Test VS project under C:\selenium
- Browse to UnitTest1.cs and right-click UnitTest1 under TestClass. Select Run Tests. This should automatically open firefox so you can be sure selenium was successfully installed.
If you still have issues at this step Right-Click References under ClassLibrary1 in VS and select Manage NuGet Packages... Search on the top right of your screen for Selenium and install both the Selenium WebDriver and Selenium WebDriver Support Classes packages.
Try to run the test again and you should be set to start testing your application!