Selenium- Firefox/geckodriver installation issue

Problem: Our selenium scripts started failing when we were running our tests on Firefox browser version 47 or higher. After a little bit of research we came to know that Selenium WebDriver 2.53.0 is not compatible with Firefox 47.0 or higher. The WebDriver component which handles Firefox browsers will be discontinued and we had to use geckodriver instead.


Why this post?

We learnt we need to upgrade to Selenium 3 and use Marionette or geckodriver to interact with Firefox version 47 or higher. In this post we would like to share set up issue which we faced and how we overcame them while setting up geckodriver in our system.


What is Geckodriver?

A Proxy for using W3C WebDriver-compatible clients to interact with Gecko-based browsers. It provides HTTP API described by the WebDriver protocol to communicate with Gecko browsers, such as Firefox (Version above 47).


Issue:

When you are trying to install geckodriver and end up facing the below exception you need to make sure you have taken care of the below 3 steps. The common exception thrown is
“The path to the driver executable must be set by the webdriver.gecko.driver system property;”

a) Upgrade your selenium to latest version as geckodriver works with selenium 3 or higher

pip install selenium

b) Just like Chrome, Opera, Internet Explorer or Microsoft Edge, Firefox will also require an executable that will run alongside the browser.
Download geckodriver using this link

c) The Selenium client bindings will try to locate the geckodriver or wires executable path from the system path. Therefore you will need to add the directory containing it to the system path.

From the path where your firefox is installed (In my case its installed in $\python\Lib\site-packages\selenium\webdriver\firefox.webdriver.py), check for the attribute ‘executable_path’.

  • If executable_path = “geckodriver”: Add the full directory path containing the geckodriver executable to the system path.
  • If executable_path=”wires”: Rename the geckodriver.exe to wires.exe and add it to the system path.
  • If you liked what you read, know more about Qxf2.


    2 thoughts on “Selenium- Firefox/geckodriver installation issue

    Leave a Reply

    Your email address will not be published. Required fields are marked *