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, 2019 in Selenium by Neha
• 6,280 points
74 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, 2019 by Frankie
• 9,810 points

Related Questions In Selenium

0 votes
1 answer

Why we need to use RemoteWebdriver Not the webdriver in Selenium Grid?

Hi Ramya, we use RemoteWebdriver in Selenium ...READ MORE

answered Jul 5, 2019 in Selenium by Abha
• 27,800 points
388 views
0 votes
2 answers

Can we run selenium tests (Firefox) on WebDriver without a GUI?

Hi Shubham, you can use headless browsers ...READ MORE

answered Aug 22, 2019 in Selenium by Abha
• 27,800 points
471 views
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,460 points
220 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,510 points
2,142 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,710 points
553 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,870 points
1,788 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, 2019 in Selenium by Frankie
• 9,810 points
5,315 views