Hello Folks,

It is very frequently asked interview question. Interviewer expects that you should be aware about internal logic of selenium.

We know that to launch a browser through Selenium we need to download a browser driver executable file (chromedriver.exe, geckodriver.exe etc). Why do we require that?

Let me relate it with a real time example.

I belong to India and speak only Hindi. I get a chance to go to Canada where only French language is spoken. When I go to Canada, I was not able to communicate to any one there as I do not know French. Tensed! A gentle man approached to me and started speaking in Hindi. I was surprised. He said that he knows Hindi and French both and he can help me as a translator. He solved my problem. For any need, I used to say in Hindi to him and he used to convert that in French and convey to a Canadian and whatever Canadian says, he translates in to Hindi for me. I faced no problem as I was able to communicate to Canadian people through gentle man who is acting as a translator.

That gentle man is none but a browser driver executable file in selenium webdriver. It helps in communication between browser and selenium.

WebDriver communicates with the browser using an specific protocol called the WebDriver JSON Wire Protocol. As per chromdriver official website, “WebDriver is an open source tool for automated testing of webapps across many browsers. It provides capabilities for navigating to web pages, user input, JavaScript execution, and more.  ChromeDriver is a standalone server which implements WebDriver’s wire protocol for Chromium”. All other browsers also provide executable file which implement JSON wire protocol.

When you run a test on chrome browser using selenium you see a message on console as below:

Starting ChromeDriver 2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7) on port 32664
Only local connections are allowed.

Now you go to chromedriver.exe (In case of windows) and double click on it. You will see a command prompt opens with same above message. It is getting started which is used to pass and receive message to/from browser. Using language client/bindings ( Java/.net etc) we pass commands to executable file and this communicates with browser and browser perform actions like click, type etc.

So we can conclude that browser driver executable is used to communicate with browser through selenium webdriver.

I tried to explain in very simple way. Hope it should help.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
#ThanksForReading
#HappySelenium

8 thoughts on “Why Do We Require Browser Driver Executable File To Launch A Browser In Selenium WebDriver?

  1. Great post it helps to learn very basic things in a laymen way, Even a novice can understand this. Thanks Amod.

  2. Thanks Bro , Relay good information, I’m trying to learn selenium but i’m got stuck in OOp Concepts please help me.

  3. I have read about Json Wire protocol but tend to forget but i believe with you layman example Candian and India i would never forget and can explain better
    Thankyou

Leave a Reply