In the Previous Tutorial, we started setting up our system for Selenium. In this tutorial, we will install other selenium dependencies.
It would be convenient for you if you save all selenium dependencies at a single place. For this tutorial, we are assuming you have created a new folder ‘teachmeselenium‘ (directly under your home directory ‘~/’ on Mac or ‘C’ drive on Windows) and saving all selenium dependencies there only. We’ll use this location in code examples for all other tutorials.
Downloading WebDriver language bindings
- In the Downloads page find the section for ‘Selenium client and WebDriver language bindings‘.
- Click on the ‘Download‘ link under Java.
- Extract the zipped file and save it to “C:\\teachmeselenium“.
If you are a Python programmer you must be knowing about PIP. For beginners, pip is a tool that is used to install python packages from PyPI.
To install WebDriver bindings for Python you need to run the following command in Command prompt or Terminal:
pip install selenium
Downloading Browser drivers
Browser drivers??? What they are? Why do I need them?
This is a very important question. Sadly, very few ask it and unfortunately, most of the selenium tutorials don’t cover it. They just make you install them.
Before answering those what and why I would first like to explain how WebDriver works. It’s a bit technical. If it makes you more confused, just read it a couple of times and move over. You’ll get it with time.
All WebDriver language bindings like selenium-java client that we downloaded earlier use a special protocol to communicate with the browser – WebDriver JSON Wire protocol
This protocol is nothing but a RESTful web service. You write a WebDriver command by following the APIs provided by that particular WebDriver implementation (e.g. selenium-java client). Each such command is mapped to one or more REST calls to the server.
Server??? From where did it drop off. I guess you were talking about browser driver.
Well, yes. When the browser driver is executed, it actually creates an HTTP server that listens at a port for calls made by clients that use WebDriver JSON Wire protocol. In our case, the client is the selenium-java client library that we downloaded. So the language bindings (e.g. selenium-java client), maps your Selenium code to an HTTP request, hit the server created by the browser driver with that HTTP request. And finally, the server communicates with the browser.
In order to run your test against a specific browser, you need to download the driver for that browser. The browser drivers create a server when executed that act as a bridge between “browser” and the “client i.e WebDriver language bindings.”
- Under ‘Third Party Browser Drivers’ paragraph, Click on the link next to ‘Chrome’ –
- In the next page, select the latest available version.
- Select the download that matches your system configuration
- Download latest geckodriver from GitHub.
- Extract the zip and save it to any drive. e.g For windows ‘C:\\teachmeselenium’.
Internet Explorer Driver Server
- Under ‘The Internet Explorer Driver Server’ paragraph, select the download version that suits your system architecture – 32/64 Bit
- The download should get started for ‘IEDriverServer.exe’. Save it in ‘C:\\selenium’ directory.
Downloading Selenium Server Standalone
The Selenium server will only be required if you need to use the remote WebDriver to run scripts through Selenium Grid. If you do not require it, you may skip this section. If you are very much eager to know about Selenium Grid right now, you may take a quick overview in This Tutorial.
To download Selenium server standalone –
- Open the browser and navigate to http://www.seleniumhq.org .
- Click ‘Download’ menu
- Under Selenium Server paragraph, click on the link next to ‘Download version’. i.e. x.y.z
- The download should get started for ‘selenium-server-standalone-x.y.z.jar’. Save this JAR in “C:\teachmeselenium” for Windows or in your home directory ‘~/’ for Mac.
- Your download should get started. Extract the zipped file and save it in ‘C:\teachmeselenium’ directory.
One more setup and I swear I am gonna unsubscribe this tutorial.
No more setup dude. Cheers, this was the last one. By the way, this tutorial is free, so unsubscribing it won’t hit me hard 🙂
Let us get our hands dirty by writing our first ever selenium scripts in the Next Tutorial.