From the last few years I was trying to familiar with not just the Microsoft Visual Studio C# ties for Selenium IDE, but also Visual Studio as a full. In my todays article I will try to describe how to go about setting up the basics, and in future I will try to write more articles on how to change (or improve, depending on your preference) the solution that you come out with.
What You Need to do
1. Microsoft Visual Studio 2008/12 IDE – where you can write and execute the C# code. In my today’s article I will use Chrome browser and Visual Studio 2008 IDE.
2. Download the Selenium C# files from the selenium website.
Download the Selenium C# files from the selenium website
3. Download the browser’s drivers. It can be Chrome / Opera / IE / Mozilla Firefox etc.
Download the browser’s drivers. It can be Chrome / Opera / IE / Mozilla Firefox etc.
4. Go to Visual Studio 2008 IDE.
5. Open Visual Studio IDE, Create New Project, Select Console application.
6. Give a name of your project.
7. It will open the coding area.
8. Now click on the “Project” menu.
9. Click on the “Add reference” menu and browse .net 3.5 or .net4.0 from your downloaded C# files. As I am using Visual Studio 2008 that’s why adding net35 reference files.
10. Now add below all related references in the namespace.
11. Now write your first Webdriver code as like below and press Start Debugging(F5). This will automatically open http://techinews24.com site in the chrome browser.
static void Main(string args)
IWebDriver d = new ChromeDriver();
Full C# Source Code
12. This will end the Selenium Webdriver integration with the Microsoft Visual Studio C#