Webdriver object creation basic query | Selenium Forum
M
Posted on 18/11/2015
WebDriver cd= new ChromeDriver(); ----1

As per this line we mean that we are accessing object of Chromedriver through reference variable of interface Webdriver.

I have gone through interface explanation in your module and i am aware of above concept.

We can also write

ChromeDriver cd= new ChromeDriver(); -----2


Please explain with some basic example whats difference between these two commands.
As class which implements interface have to implement all the methods declared in interface .


So if all methods are used by Chromedriver which are there in Webdriver , what addidtional benefit we are getting from statement 1.

M
Replied on 18/11/2015

[quote:2wd3ozok]So if all methods are used by Chromedriver which are there in Webdriver , what addidtional benefit we are getting from statement 1.[/quote:2wd3ozok]

only major benefit you will get is you can open any browser by it. which comes in handy if you using framework.