Exercise 2 - What is a WebDriver

WebDriver and RemoteWebDriver are the class’s through which the user (you) controls the browser. ChromeDriver is a derived from the RemoteWebDriver, ChromeDriver has all the functionality of its parent class RemoteWebDriver and some Chrome specific implementation as well.

The using directive allows the use of types in a namespace so that you do not have to qualify the use of a type in that namespace. In Exercise-1 the first line of code in the Main() looked like this: var cDriver = new OpenQA.Selenium.Chrome.ChromeDriver(); but in this exercise the code wil look like this: var cDriver = new ChromeDriver(); But first we will need to add a using directive on line one of the program.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
using OpenQA.Selenium.Chrome;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
          var cDriver = new ChromeDriver();
        }
    }
}