Python Forum

Full Version: A problem with using selenium
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
from selenium import webdriver
browser = webdriver.Firefox()
print(type(browser))
browser.get('http://inventwithpython.com')
In IDLE I receive these traceback errors, don't understand a thing.
Error:
Traceback (most recent call last): File "C:\Python36\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start stdin=PIPE) File "C:\Python36\lib\subprocess.py", line 709, in __init__ restore_signals, start_new_session) File "C:\Python36\lib\subprocess.py", line 997, 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:\Python36\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 157, in __init__ self.service.start() File "C:\Python36\lib\site-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. >>> print(type(browser)) Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> print(type(browser)) NameError: name 'browser' is not defined >>> browser.get('http://inventwithpython.com') Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> browser.get('http://inventwithpython.com') NameError: name 'browser' is not defined
You need to download latest geckodriver from here - LINK and then update the Path system variable to add the full directory path to the executable geckodriver.
Thank you. I downloaded it and unzipped in Python folder. Interestingly, didn't need to updatethe Path system variable.