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
It will make use of Interface Concept.See the below code.
FirefoxDriver f = new FirefoxDriver();
ChromeDriver c = new ChromeDriver();
To load a page using chrome,
c.get("google.com");
If I want to use same call with firefox, I need to comment the above line and need to write a new line like this
//c.get("google.com");
f.get("google.com");
This will go on increasing , ending up with specific code for each instance of driver. But if I assign the the driver instance to WebDriver interface variable, I can write single set of code which will work for all drivers.
WebDriver d;
d = FireFoxDriver();
//just replace the above line with d = ChromeDriver() or InternetExplorer();
d.get("google.com");
d.getTitle();
d.close();