Reputation: 858
Newbee here! Help out guys!
Environment: Windows 10.1 (64Bit) + Selenium + Python + geckodriver.exe (latest version - v0.13.0 - https://github.com/mozilla/geckodriver/releases)
Issue:
Code Used:
from selenium import webdriver
path = 'C:\Program Files (x86)\Python36-32\Lib\site-packages\selenium\webdriver\firefox\geckodriver.exe'
browser = webdriver.Firefox(path)
browser.get("https://www.google.com/")
Note:
Questions:
Kindly reply! Thanks for your time!
Upvotes: 0
Views: 5032
Reputation: 6398
Add the following value to PATH :
C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\firefox (i.e., till geckodriver.exe)
When looking for files/exes in that PATH, it won't look inside the sub-folders of that path.
Or
Keep the geckodriver.exe in one of the following paths, which are already added to PATH
:
1. C:\Program Files (x86)\Python36-32\Scripts
2. C:\Program Files (x86)\Python36-32
3. C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver
Note: System Restart may be necessary.
Upvotes: 0
Reputation: 41
try to use executable_path , this param use to specify the path to run geckodriver
base_path = "./"
driver = webdriver.Firefox(executable_path=os.path.join(base_path, "geckodriver"), **config)
Upvotes: 1
Reputation: 52665
Please try following and let me know whether it solved your issue or not
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium import webdriver
path = 'C:\Program Files (x86)\Python36-32\Lib\site-packages\selenium\webdriver\firefox\geckodriver.exe'
binary = FirefoxBinary('C:\Path\to\firefox.exe') # Set your own path
browser = webdriver.Firefox(path, firefox_binary=binary)
Upvotes: 0