I am novice to Java or Selenium.
I just need help to understand one basic question.
Why we assign firefoxdriver instance to WebDriver? WebDriver driver=new Firef
When creating a new instance of browser new ChromeBrowser();
ChromeBrowser(ChromeDriver.exe) is running on local machine and will die with the instance. So the browser restarts with each instance creation. To avoid restart of browser multiple times, Webdriver takes responsibility by referring Browser instance and controls browser not to be restarted for each instance creation.
WebDriver driver = new ChromeDriver();
From the documentation;
A WebDriver implementation that controls a Chrome browser running on the local machine. This class is provided as a convenience for easily testing the Chrome browser. The control server which each instance communicates with will live and die with the instance. To avoid unnecessarily restarting the ChromeDriver server with each instance, use a RemoteWebDriver coupled with the desired ChromeDriverService, which is managed separately.