Integration of
selenium with C# is very easy. It would not take more than 5-10 minutes to
start it and create/test a small selenium project.
Step 1: Create Solution and Project
Open Visual Studio and create a
new solution with one empty “Unit Test” project.
Step2: Install Selenium NuGet packages
Goto Tools -> Library Pacakage Manager
-> Manage NuGet Packages for Solution.
Search for selenium in open window
Install “Selenium
WebDriver” and “Selenium WebDriver Support Classes” and close the window.
See references in “solution
explorer”. “WebDriver” and “Webdriver.Support” will be visible.
Step3: Write some code to test it
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Firefox;
namespace UnitTestProject2
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
FirefoxDriver driver = new FirefoxDriver();
driver.Navigate().GoToUrl("https://www.google.co.in");
}
}
}
No comments:
Post a Comment