Webdriver is an interface, not a class. We create a Webdriver reference driver and assign it to an object of class FirefoxDriver. To perform the testing on Firefox, make an object of class FirefoxDriver. Likewise, to test on chrome, use Chromedriver class' object and assign it to Webdriver. Webdriver is an interface which is implemented by both FirefoxDriver class and ChromeDriver class(and classes for other browsers like IE, Safari). Objects of only those classes can be assigned to an interface reference which implement that interface(which in this case is Webdriver interface)