| || |
WebDriver / Firefox Driver instantiation difference
Is there a difference between the following:
Webdriver driver = new FirefoxDriver();
Firefox driver = new FirefoxDriver();
Is there any significant difference in terms of what i would be able to access specifically with the different driver instances created in both the cases.
It's better to use Webdriver driver, because you can substitute with a different webdriver like remote webdriver etc... This way you can make your tests cross browser compatible.
driver = new InternetExplorerDriver();
driver = new FirefoxDriver()
Last edited by dlai; 03-21-2013 at 12:12 AM.
Ahhh that really helps David. I completely get it now...Thanks a lot
That is basically the concept of inheritance and interfaces. Each driver drives from a base class (in case of C# RemoteWebDriver), the base class implements different interfaces (IWebDriver in case of C#).So using IWebDriver you can use object of any driver. Each driver override some functions of the base class to be able to adopt for the browser differences