0

Why is the code //RemoteWebDriver driver= new FirefoxDriver(); not used instead of //WebDriver driver= new FirefoxDriver() to create a driver object?

I feel that RemoteWebDriver gives more capabilities for the driver instance than webdriver reference. Can someone clarify this?

WebDevBooster
  • 14,674
  • 9
  • 66
  • 70
Pavan
  • 1
  • 1
  • Possible duplicate of [what is the difference between ChromeDriver and WebDriver in selenium?](https://stackoverflow.com/questions/48079120/what-is-the-difference-between-chromedriver-and-webdriver-in-selenium) – undetected Selenium Feb 07 '18 at 09:00
  • I think it is not a duplicate. He didn't confuse about the difference between an interface and its implementation. His confusion is about choosing between two implementations. – learningQA Oct 31 '18 at 09:47

3 Answers3

0

WebDriver will start up a web browser on the computer where the code instantiates it. For example. If you write a bit of code, and then run it to see how you are doing, the browser will pop up on your screen and you will see WebDriver begin to manipulate that web browser window (if everything went well!)

With a major exception which I will explain below, RemoteWebDriver will do the same thing; it will open and manipulate a browser window (if everything went well!) Generally speaking, You can actually switch the instatiation of a WebDriver with a RemoteWebDriver (well, there are advanced cases where you might not be able too do this) The major difference is that RemoteWebDriver sends that request to open and control a web browser to a server, so you normally wouldn’t see the browser open and do it’s thing.

Selenium server is the program that runs and waits for RemoteWebDriver connections. You can run it on your local computer to test it out. If you get it set up and running, you’ll be able to create a RemoteWebDriver and see that the Selenium server accepts the connection and allows you to control the web browser window.

The gains from using RemoteWebDriver?

If you can do connect to a local Selenium server, you can be confident that you have the knowledge and skills needed to connect to a remote Selenium server, or even to a paid service like SauceLabs (Hosting Selenium for you) that allows you to run lots of tests on lots of OS’s and lots of browsers without having to actually maintain or install any of them (Linux, Windows 8, Windows 10, MacOS, Andriod, IOS, IE, Firefox, Opera, Safari, Firefox Mobile, etc) You’ll want to look into running tests asynchronously at this point. You don’t have to run them one at a time, so can test a large number of OS/Browser variations in a very short time.

Vel Guru
  • 394
  • 1
  • 3
  • 16
0

What does it mean when something is used only for client/server communication?

When you uses a Selenium grid with have one hub and multiple clients, you invoke RemoteWebDriver through which you instantiate the server and and make the request to it.

Robert Columbia
  • 6,313
  • 15
  • 32
  • 40
0

WebDriver is an interface in selenium which extends SearchContext interface (super most interface in selenium) Where as RemoteWebdriver is a class which implements WebDriver, We can use RemoteWebdriver, when we going to execute the test in romote environment,(selenium grid). WebDriver interface will invoke the driver locally, Currently in automation mostly we are using WebDriver only. Grid not using widely.

WebDriver driver=new ChromeDriver() ;

driver is the reference variable where used to access chromedriver class. Using driver instance we can access all the unimplemented methods available in WebDriver interface, also able to access all the properties available in chromedriver class.

For more details

https://www.softwaretestingmaterial.com/webdriver-driver-new-firefoxdriver/