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,300 points
228 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
• 28,040 points
1,854 views
0 votes
3 answers

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

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

answered Sep 1, 2020 in Selenium by Sri
• 3,100 points
2,336 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
437 views
0 votes
2 answers

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,520 points
5,571 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,100 points
6,174 views
0 votes
2 answers

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

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

answered Sep 4, 2020 in Selenium by Sri
• 3,100 points
1,214 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,890 points
3,832 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
12,089 views