Hi, I am new at programming and I am making data crawler with selenium and python. I wrote other parts of the code without any mistakes, but, in the part where I put on the location of webdriver(I am using geckodriver),
terminal keep saying Unexpectedly exited. Code status was: -7 everytime when I hit run. I tried to find someone in every community who has same problem with me, but all of them had similar but different error. Such as -64 or 345993. I am really sick and tired of finding the solutions for this. I havs already spent almost two weeks!
Here's my code:
import selenium
from selenium import webdriver
from webdriver_manager.firefox import GeckoDriverManager
driver = webdriver.Firefox(executable_path=r'/home/sejahui/cd/geckodriver')
driver.get('https://google.com')
driver.close()
*The reason why I put executable path behind the location of Geckodriver is export PATH=$PATH terminal command solution didn't work for me.
Here's my error:
sejahui@localhost:~/python$ env PYTHONIOENCODING=UTF-8 PYTHONUNBUFFERED=1 /usr/bin/python3 /home/sejahui/.vscode-oss/extensions/ms-python.python-2020.6.91350/pythonFiles/ptvsd_launcher.py --default --client --host localhost --port 38579 /home/sejahui/python/Pythonwork/Stock_data_crawler_selenium
Traceback (most recent call last):
File "/home/sejahui/.vscode-oss/extensions/ms-python.python-2020.6.91350/pythonFiles/ptvsd_launcher.py", line 48, in <module>
main(ptvsdArgs)
File "/home/sejahui/.vscode-oss/extensions/ms-python.python-2020.6.91350/pythonFiles/lib/python/old_ptvsd/ptvsd/__main__.py", line 432, in main
run()
File "/home/sejahui/.vscode-oss/extensions/ms-python.python-2020.6.91350/pythonFiles/lib/python/old_ptvsd/ptvsd/__main__.py", line 316, in run_file
runpy.run_path(target, run_name='__main__')
File "/usr/lib/python3.8/runpy.py", line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/sejahui/python/Pythonwork/Stock_data_crawler_selenium", line 13, in <module>
driver = webdriver.Firefox(executable_path=r'/home/sejahui/cd/geckodriver')
File "/home/sejahui/.local/lib/python3.8/site-packages/selenium/webdriver/firefox/webdriver.py", line 157, in __init__
self.service.start()
File "/home/sejahui/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/home/sejahui/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service /home/sejahui/cd/geckodriver unexpectedly exited. Status code was: -7
Another question: Can I use Chromium instead of chrome with Chromedriver? If so, how can I do it?