Why we assign firefox instance to webdriver?

0 votes
Why we assign firefox driver instance to WebDriver? WebDriver driver=new FirefoxDriver()

I know that this is kind of Late binding in Java, because we can assign IEDriver or some other instance to WebDriver at later point of time.

1: But this applies to classes, right?

2: WebDriver is an interface, then can we create an object instance of an interface?
Jan 22 in Selenium by Neha
• 6,280 points
35 views

1 answer to this question.

0 votes
Webdriver is an interface, not a class. We create a Webdriver reference driver and assign it to an object of class FirefoxDriver. To perform the testing on Firefox, make an object of class FirefoxDriver. Likewise, to test on chrome, use Chromedriver class' object and assign it to Webdriver. Webdriver is an interface which is implemented by both FirefoxDriver class and ChromeDriver class(and classes for other browsers like IE, Safari). Objects of only those classes can be assigned to an interface reference which implement that interface(which in this case is Webdriver interface)
answered Jan 22 by Frankie
• 9,810 points

Related Questions In Selenium

0 votes
1 answer
0 votes
2 answers
0 votes
1 answer

Why to use WebDriver instead of Selenium IDE?

Selenium IDE is a Record and Playback ...READ MORE

answered Jul 11, 2018 in Selenium by Meci Matt
• 9,420 points
132 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,090 points
592 views
0 votes
1 answer
0 votes
1 answer

What is the role of TestNG & JUnit frameworks in Selenium?

Well TestNG and JUnit are test frameworks ...READ MORE

answered Apr 18, 2018 in Selenium by king_kenny
• 3,650 points
266 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
901 views
0 votes
1 answer
0 votes
1 answer

How to send ALT/SHIFT/CONTROL key in Selenium WebDriver?

When we generally use ALT/SHIFT/CONTROL keys, we ...READ MORE

answered Feb 8 in Selenium by Frankie
• 9,810 points
1,640 views