3

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?

6
  • 1
    Version of Firefox? Commented Apr 12, 2017 at 10:27
  • @KishanPatel 52.0.2 (64bit) Commented Apr 12, 2017 at 10:29
  • It won't work. Use version 47 or below. Open Issue prevails in github github.com/SeleniumHQ/selenium/issues/3658 Commented Apr 12, 2017 at 10:33
  • 1
    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') Commented Apr 12, 2017 at 10:45
  • 1
    @fedterzi Thanks! Solved... Please write your comment as a post so i can flag it as "Best Answer" :) Commented Apr 12, 2017 at 10:53

2 Answers 2

3

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')
Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.