Following some tutorials on Selenium, I installed the geckodriver
. In order to run a simple code on python to run Selenium, I have to specify this path in the c
The Firefox Developer Edition browser is not installed at the conventional location where regular Firefox browser gets installed. In my Windows 8 box Firefox Developer Edition browser got installed within the directory:
C:\Program Files\Firefox Developer Edition
Now, while invoking Firefox Developer Edition browser you need to pass the absolute path of the Firefox Developer Edition binary through the argument firefox_binary
as follows:
Code Block:
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
firefox_dev_binary = FirefoxBinary(r'C:\Program Files\Firefox Developer Edition\firefox.exe')
driver = webdriver.Firefox(firefox_binary=firefox_dev_binary, executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
# driver.quit()
Console Output:
Page Title is : Google
Browser Snapshot:
As you are on Linux you need to provide the absolute path of:
So your effective code block will be:
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
firefox_dev_binary = FirefoxBinary('/path/to/Firefox Developer Edition/firefox')
driver = webdriver.Firefox(firefox_binary=firefox_dev_binary, executable_path='/home/xx/Downloads/geckodriver-v0.24.0-linux64/geckodriver')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
# driver.quit()
You can use FirefoxBinary
as described here:
Setting path to firefox binary on windows with selenium webdriver
To set the custom path to Firefox you need to use FirefoxBinary:
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary('F:\FirefoxPortable\Firefox.exe')
driver = webdriver.Firefox(firefox_binary=binary)