Thursday, September 10, 2015

How to use Chrome webdriver with Selenium(C#)

Want to run your selenium script on Chrome browser. See the solution below:

Step1: Download Chrome webdriver


Download this driver from here and put this driver exe at a particular location(like i put in "E:\")

Step2: Code to use this driver


using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium;

namespace UnitTestProject2
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            IWebDriver driver = new ChromeDriver(@"E:\");
           driver.Navigate().GoToUrl("https://www.google.co.in");
        }
    }
}


Step3: Run this code and we are done



No comments:

Post a Comment