Tuesday, 3 March 2020

Why WebDriver driver = new ChromeDriver() ?


Below is WebDriver Interface & Respective class implementation architecture.





ChromeDriver driver = new ChromeDriver(); // Lot of methods from parent calss RemoteWebDriver

vs

WebDriver driver = new ChromeDriver(); // we can access only few methods from WebDriver Interface & SerchContext Interface







Ex: Advantage of interface

Public List getList(){
       return new ArrayList<String>()
}

We can return any implemented class for any method which has return type as interface




No comments:

Post a Comment