mozilla / geckodriver

WebDriver for Firefox
https://firefox-source-docs.mozilla.org/testing/geckodriver/
Mozilla Public License 2.0
7.2k stars 1.52k forks source link

weird issue geckodrive deprecation #2021

Closed moezbenrebah closed 2 years ago

moezbenrebah commented 2 years ago

Hi guys, I recently began to learn selenium with python on ubuntu 22.04 LTS, and currently, I have an issue with a deprecation error message with geckodriver as below:

/selenium-scratch/supported-webbrowsers.py:3: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
  driver = webdriver.Firefox(executable_path="/usr/local/bin/geckodriver")
Traceback (most recent call last):
  File "/home/moez/Documents/selenium-scratch/supported-webbrowsers.py", line 3, in <module>
    driver = webdriver.Firefox(executable_path="/usr/local/bin/geckodriver")
  File "/home/moez/.local/lib/python3.10/site-packages/selenium/webdriver/firefox/webdriver.py", line 180, in __init__
    RemoteWebDriver.__init__(
  File "/home/moez/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 275, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/moez/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 365, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/moez/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 430, in execute
    self.error_handler.check_response(response)
  File "/home/moez/.local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 1

I already downloaded the latest geckodriver from this link and I moved it to "/usr/local/bin" and the script is written like below:

from selenium import webdriver

driver = webdriver.Firefox(executable_path="/usr/local/bin/geckodriver")

driver.get('https://goaheadtravel.herokuapp.com/')

any idea will be appreciated guys, thank you!