Before setting up Selenium with Visual Studio, we should make sure that machine should have installed Visual Studio 2013 and NuGet.
So if above pre-requisites are in right place then start Visual Studio and create new project.
Select Visual C# > Test > Unit Test Project. Provide project name, location and click on OK button.
Select your project and right click. Click on Manage NuGet Packages…option.
Make sure you are pointing to ‘Online‘. Search the term ‘Selenium‘ and install Selenium WebDriver and Selenium WebDriver Support Classes. Now close the ‘Manage NuGet Package‘ window.
We will use Chrome browser to execute our first selenium script, so for this download Chrome driver from here.
Download and extract the file.
Open UnitTest1.cs file and include following namespaces-
Now under TestMethod1() add following code-
IWebDriver driver = new ChromeDriver(@”D:\Download\VisualStudio_Projects”);
Now run the method. It will open the Chrome browser with bing.com and will search the term.
Comment out if above steps are not working for you.