0

I installed python version 3.5.2, selenium version 3.0.1 and firefox version 49.0.2.

After all of that and in my shell scripting I typed

    >>> from selenium import webdriver
    >>> browser = webdriver.Firefox()

and got error as this below: Could someone guide me on what is wrong here. I appreciate it. I am just starting out on python. Thanks

#
Traceback (most recent call last):
  File "C:\Users\D\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 64, in start
    stdout=self.log_file, stderr=self.log_file)
  File "C:\Users\D\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "C:\Users\D\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    browser = webdriver.Firefox()
  File "C:\Users\D\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 135, in __init__
    self.service.start()
  File "C:\Users\D\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 
#
Johnseito
  • 315
  • 1
  • 9
  • 24
  • possible duplicate of http://stackoverflow.com/questions/40208051/selenium-using-python-geckodriver-executable-needs-to-be-in-path. Refer answer http://stackoverflow.com/a/40208762 – Naveen Kumar R B Nov 14 '16 at 18:05
  • download geckodriver from https://github.com/mozilla/geckodriver/releases and keep in System PATH variable. – Naveen Kumar R B Nov 14 '16 at 18:07
  • Hi where do we put the geckodriver, to what path ? I downloaded the lastest version "geckodriver-v0.11.1-arm7hf (1).tar" and I put it to path C:\Users\D\AppData\Local\Programs\Python\Python35-32\Scripts. still have error. thanks – Johnseito Nov 14 '16 at 20:52
  • I also direct the environment variable path to the place where I put the geckodriver.exe, but what path or which directory should we put the geckodriver.exe file ? Thanks – Johnseito Nov 14 '16 at 21:46
  • I added geckodriver.exe file to the scripts directory and put in system path variable pointing to there. After that I entered `from selenium import webdriver browser = webdriver.Firefox()` and I got error message _ raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line_ **I know this means the path is correct however how can I point Firefox to the correct folder ? ** – Johnseito Nov 15 '16 at 04:35
  • Ok, thank you, I restarted my computer and it worked, took awhile but it look like Firefox pop open with no addresses. **and with no error messages in scripting shell either. ;-) – Johnseito Nov 15 '16 at 04:57
  • good to hear that. add the following line, browser.get("htttp://stackoverflow.com"). you should see browser opening the page. otherwise share the error. suggestion: Don't user "browser", use "driver" as a reference which people normally follows. – Naveen Kumar R B Nov 15 '16 at 05:31
  • Ok, thanks. That works. – Johnseito Nov 17 '16 at 01:25

0 Answers0