The problem of running python, and calling Firefox browser under Ubuntu system to grab data

the program is as follows:
from selenium import webdriver

browser = webdriver.Firefox ()
the running result is as follows:
Traceback (most recent call last):
File "/ usr/local/lib/python3.4/dist-packages/selenium/webdriver/common/service.py", line 76, in start

stdin=PIPE)

File "/ usr/lib/python3.4/subprocess.py", line 859, in init

restore_signals, start_new_session)

File "/ usr/lib/python3.4/subprocess.py", line 1457, in _ execute_child

raise child_exception_type(errno_num, err_msg)

FileNotFoundError: [Errno 2] No such file or directory: "geckodriver"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "test.py", line 3, in < module >

browser = webdriver.Firefox()

File "/ usr/local/lib/python3.4/dist-packages/selenium/webdriver/firefox/webdriver.py", line 164, in init

self.service.start()

File "/ usr/local/lib/python3.4/dist-packages/selenium/webdriver/common/service.py", line 83, in start

os.path.basename(self.path), self.start_error_message)

selenium.common.exceptions.WebDriverException: Message: "geckodriver" executable needs to be in PATH.
what is the problem?

Jul.27,2021

error reporting is a PATH problem
see if this can solve your problem:
python-geckodriver-executable-needs-to-be-in-path" rel=" nofollow noreferrer "> https://stackoverflow.com/que.


it says you don't have a Firefox driver, and that Path path is the location of the Firefox driver, not the location of the Firefox browser. Just download one from the Internet

Menu