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 command line:
export PATH=$PATH:/home/xx/Downloads/geckodriver-v0.24.0-linux64
But I want Selenium to open the Developer edition I have as it contains the extension I want to test: When I sepcify the path for the Developer edition executable:
export PATH=$PATH:/home/xx/Documents/ff_extension/firefox/
Then run my python script:
from selenium import webdriver
browser = webdriver.Firefox()
Selenium still opens the geckodriver
browser.
Q: How can I instruct Selenium to run Firefox Dev. Edition in the path I specify?
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()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With