How to open Firefox browser by passing driver executable path

The Blog To Learn Selenium and Test Automation

How to open Firefox browser by passing driver executable path

In this post, we have seen how to start Firefox. Before executing the script, we ensured that Firefox driver is available in PATH.

There is another way to start Firefox without PATH settings.

Instead of setting PATH environment variable, executable_path property can be passed while invoking Firefox instance.

Syntax:
driver = webdriver.Firefox(executable_path=”[path to driver location]”);

from selenium import webdriver

driver = webdriver.Firefox(executable_path="/data/Drivers/geckodriver")
driver.get("http://www.google.com")

 

4 Responses

  1. […] set browser driver path details in PATH environment variable or have to pass browser driver path to executable_path variable while creating browser […]

  2. […] There is another way to start Chrome browser without PATH settings. We have seen this for Firefox Browser […]

Leave a Reply

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