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
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.
Author: Amod Mahajan
My name is Amod Mahajan and I am an IT employee with 6+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went through so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning