This is a simple example to show how to navigate to url using selenium chromedriver
Install selenium webdriver using Nuget Package
PM> Install-Package Selenium.WebDriver.ChromeDriver -Version 80.0.3987.10600
Below code performs a navigation to google.com
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Support.UI;
using System.Collections.ObjectModel;
using System.Threading;
using System.Configuration;
namespace OpenURL
{
class Program
{
static void Main(string[] args)
{
IWebDriver driver = null;
try
{
//driver = new ChromeDriver(@"c:\temp\");//load chromedriver from desired folder.
driver = new ChromeDriver(AppDomain.CurrentDomain.BaseDirectory);//load chromedriver from bin folder as nuget package deploys chrome driver .exe and other dlls into bin
driver.Url = "https://www.google.com";//Set the url you would like to navigate
driver.Manage().Window.Maximize();
driver.Navigate();
}
catch (Exception e)
{
Console.WriteLine("Exception" + e.ToString());
}
finally
{
Thread.Sleep(2000);
driver.Quit();
Console.ReadLine();
}
}
}
}
Use bin or desired folder to load chrome driver
driver = new ChromeDriver(AppDomain.CurrentDomain.BaseDirectory);
//this helps loading chromedriver from bin folder
driver = new ChromeDriver(@"c:\temp\");
//this helps to load chromdriver.exe from temp folder.