symptoms
When I run the Python code below in the Jupiter Notebook that I opened in VSCode, an error appears and Firefox cannot start.
from selenium import geckodriver
ImportError Traceback (most recent call last)
/tmp/ipykernel_3513/2951967038.py in<module>
---->1 from selenium import geckodriver
ImportError: cannot import name 'geckodriver' from 'selenium' (/home/yusuke/anaconda3/envs/dev/lib/python3.9/site-packages/selenium/_init__.py)
from time import sleep
browser=geckodriver.Firefox()
Expectations
I want to start Firefox.
Reproduction Steps
Reproduction instructions (add)
7. Uninstall the geckodriver.
8. Install version 99 of Google Chrome for Linux.
9. Install ChromeDriver version 99.
10. Run the Python code below on the Jupiter Notebook that opened in VSCode.
I also added an error under the code.
from selenium import webdriver
from time import sleep
browser=webdriver.Firefox()
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
~/anaconda3/envs/dev/lib/python3.9/site-packages/selenium/webdriver/common/service.py in start(self)
71cmd.extend(self.command_line_args())
--- >72self.process=subprocess.Popen(cmd, env=self.env,
73close_fds=platform.system()!='Windows',
~/anaconda3/env/dev/lib/python3.9/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creation_logs, restoration, restaurant, restaurant_news, resume, store, resume, store_s
950
-->951self._execute_child(args, executable, preexec_fn, close_fds,
952pass_fds, cwd, env,
~/anaconda3/env/dev/lib/python3.9/subprocess.py in_execute_child(self,args,executable,preexec_fn,close_fds,pass_fds,cwd,env,startupinfo,creationflags,shell,p2cred,c2cred,c2cred,cred,c2cred,cred,prite,prite,red,prite,red,red,red,red,red,red,red,red,red,red,red,red,red,red,red,red,red,red,red,
1820 err_msg = os.sterror(errno_num)
->1821 raise child_exception_type(errno_num, err_msg, err_filename)
1822 raise child_exception_type(err_msg)
FileNotFoundError: [Errno2] No such file or directory: 'geckodriver'
During handling of the above exception, another exception occurred:
WebDriverException Traceback (most recent call last)
/tmp/ipykernel_3513/4270241205.py in<module>
---->1 browser=webdriver.Firefox()
~/anaconda3/envs/dev/lib/python3.9/site-packages/selenium/webdriver/firefox/webdriver.py in __init_(self,firefox_profile,firefox_binary,timeout,capabilities,proxy,executable_path,options,service_log_paths,firefoil_service_paths,firefires,service_paths,firefirections,service_paths,firefires,firefirections
162 service_args = service_args,
163 log_path = service_log_path )
-->164self.service.start()
165
166 capabilities.update(options.to_capabilities())
~/anaconda3/envs/dev/lib/python3.9/site-packages/selenium/webdriver/common/service.py in start(self)
79 except OSError as err:
80 if err.errno==errno.ENOENT:
--- >81 raise WebDriverException(
82"%s' executable needs to be in PATH.%s"%(
83 os.path.basename(self.path), self.start_error_message)
WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
Resolution Steps
PATH="$PATH":/usr/local/bin/geckodriver
PATH="$PATH":/usr/local/bin/chromedriver
from selenium import webdriver
from time import sleep
browser=webdriver.Firefox()
581 PHP ssh2_scp_send fails to send files as intended
912 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.