2
votes

I have problem with Selenium! I tried both 3.6 and 2.7 but no difference! I'm using win7 (64bit)

let's start with a simple code:

binary = FirefoxBinary(r"C:\Program Files\Mozilla Firefox\firefox.exe")
fp = webdriver.FirefoxProfile()
driver = webdriver.Firefox(firefox_binary=binary, firefox_profile=fp)

And so, i get these errors:

C:\Python27\python.exe E:/Python/MathBattle_Solver/test.py

Traceback (most recent call last): File "E:/Python/MathBattle_Solver/test.py", line 13, in download("https://www.google.com")

File "E:/Python/MathBattle_Solver/test.py", line 9, in download browser = webdriver.Firefox(capabilities=firefox_capabilities, executable_path=r'C:\Windows\System32\geckodriver.exe')

File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 144, in init self.service.start()

File "C:\Python27\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start os.path.basename(self.path), self.start_error_message)

selenium.common.exceptions.WebDriverException: Message: 'geckodriver.exe' executable needs to be in PATH.

I downloaded the "geckodriver.exe", put it into the system32 folder and added into PATH system variable from the environment variables but nothing happened! still the same error!

Any idea?

2
Version of Firefox?Kishan Patel
@KishanPatel 52.0.2 (64bit)MohamadKh75
It won't work. Use version 47 or below. Open Issue prevails in github github.com/SeleniumHQ/selenium/issues/3658Kishan Patel
Try to put geckodriver.exe in the script folder and call webdriver.Firefox with: driver = webdriver.Firefox(firefox_binary=binary, firefox_profile=fp, executable_path='geckodriver.exe')fedterzi
@fedterzi Thanks! Solved... Please write your comment as a post so i can flag it as "Best Answer" :)MohamadKh75

2 Answers

3
votes

It works for me on 52.0.2 (64bit) and Geckodriver 0.15.0-win64 (from https://github.com/mozilla/geckodriver/releases).

Put geckodriver.exe in the script folder and then call webdriver.Firefox with

driver = webdriver.Firefox(firefox_binary=binary, firefox_profile=fp, executable_path='geckodriver.exe')
1
votes

Selenium requires a driver to interface with the chosen browser. Firefox, for example, requires geckodriver, which needs to be installed before the below examples can be run. Make sure it’s in your PATH, e. g., place it in /usr/bin or /usr/local/bin.

Failure to observe this step will give you an error selenium.common.exceptions.WebDriverException: Message: ‘geckodriver’ executable needs to be in PATH

Put geckodriver.exe in the script folder and then call webdriver.Firefox with