12 steps of Selenium WebDriver Setup with C#
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.
3. 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.
using OpenQA.Selenium;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;
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.
namespace WebdriverTest
{
class Program
{
static void Main(string[] args)
{
IWebDriver d = new ChromeDriver();
d.Navigate().GoToUrl(“https://moinur.ca”);
}
}
}
12. This will end the Selenium Webdriver integration with the Microsoft Visual Studio C#
What’s up friends, how is everything, and what you would like to say regarding this piece of writing, in my view its actually remarkable in support of me.
I am fine. Thank you. Happy to hear this article helps you. Please keep in touch with us will publish more article on this shortly.