What does this declaration mean?
WebDriver driver = new ChromeDriver();
What does this imply? Please help.
What does this declaration mean?
WebDriver driver = new ChromeDriver();
What does this imply? Please help.
This declaration...
WebDriver driver = new ChromeDriver();
...implies that you are creating an instance of the WebDriver interface i.e. driver
and casting it to ChromeDriver Class.
The WebDriver Interface is similar like a agreement which the 3rd party browser vendors like Mozilla, Chrome, Internet Explorer, Safari, etc have to adhere and implement the same. This would in-turn help the end-users to use the exposed APIs to write a common code and implement the functionalities across all the available browsers without any change.
Through the line:
WebDriver driver = new ChromeDriver();
you are creating an instance of the WebDriver interface and casting it to ChromeDriver class which will be able to invoke and act on the methods implemented by ChromeDriver and supported by Chrome Browser only.
We write our Automated Test Script against this interface so that in future we can swap in a more fully featured browser when there is a requirement/availabily for one which is in compliant with WebDriver - W3C Living Document.
You can find a couple of detailed discussions in: