inderpreet99 / afraid-autologin

Automatically login to FreeDNS.Afraid.org to avoid termination due to dormant account
Apache License 2.0
21 stars 10 forks source link

TypeError: WebDriver.__init__() got an unexpected keyword argument 'firefox_profile' #10

Open Sopor opened 1 year ago

Sopor commented 1 year ago

I can't get this to run at all 😥

$ python autologin.py
2023-08-02 15:41:24,847 >>> DEBUG: afraid-autologin startup
2023-08-02 15:41:24,848 >>> DEBUG: init browser
/home/user/apps/afraid-autologin/autologin.py:66: DeprecationWarning: firefox_profile has been deprecated, please use an Options object
  profile = webdriver.FirefoxProfile()
Traceback (most recent call last):
  File "/home/user/apps/afraid-autologin/autologin.py", line 122, in <module>
    main(logger)
  File "/home/user/apps/afraid-autologin/autologin.py", line 69, in main
    browser = webdriver.Firefox(firefox_profile=profile)
TypeError: WebDriver.__init__() got an unexpected keyword argument 'firefox_profile'
strenkml commented 10 months ago

I fixed these issue in this branch: https://github.com/strenkml/afraid-autologin/tree/fix-gecko

If you are running the docker, you can just pull down the latest version of the image and everything should be working

slmingol commented 8 months ago

I just tried the latest docker and it still seems to be failing. If I docker exec into the container and attempt to run it manually:

# bash -c "PATH=$PATH:/usr/local/bin/; source /app/venv/bin/activate && python /app/autologin.py"
2024-02-14 02:02:35,903 >>> DEBUG: afraid-autologin startup
2024-02-14 02:02:35,903 >>> DEBUG: init browser
The geckodriver version (0.33.0) detected in PATH at /usr/local/bin/geckodriver might not be compatible with the detected firefox version (120.0.1); currently, geckodriver 0.34.0 is recommended for firefox 120.*, so it is advised to delete the driver in PATH and retry
Traceback (most recent call last):
  File "/app/autologin.py", line 125, in <module>
    main(logger)
  File "/app/autologin.py", line 72, in main
    browser = webdriver.Firefox(options=options)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.12/site-packages/selenium/webdriver/firefox/webdriver.py", line 69, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/app/venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 209, in __init__
    self.start_session(capabilities)
  File "/app/venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 293, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 348, in execute
    self.error_handler.check_response(response)
  File "/app/venv/lib/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 1
slmingol commented 8 months ago

Ah scratch that you're --headless option works, didn't realize that was being used by the script to facilitate the login:

# bash -c "PATH=$PATH:/usr/local/bin/; source /app/venv/bin/activate && python /app/autologin.py --verbose --headless"
2024-02-14 02:05:52,904 >>> DEBUG: afraid-autologin startup
2024-02-14 02:05:52,905 >>> DEBUG: init virtual display
2024-02-14 02:05:53,005 >>> DEBUG: init browser
The geckodriver version (0.33.0) detected in PATH at /usr/local/bin/geckodriver might not be compatible with the detected firefox version (120.0.1); currently, geckodriver 0.34.0 is recommended for firefox 120.*, so it is advised to delete the driver in PATH and retry
2024-02-14 02:05:57,216 >>> DEBUG: navigating to login page
2024-02-14 02:05:59,636 >>> DEBUG: submit login form
2024-02-14 02:06:01,864 >>> DEBUG: extending account if dormant
2024-02-14 02:06:03,780 >>> DEBUG: [<selenium.webdriver.remote.webelement.WebElement (session="XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX", element="f5ae24f9-f37b-4d86-8a07-c34ded56cfd3")>]
2024-02-14 02:06:06,523 >>> INFO: login sucessful
#