jprouty / mint-amazon-tagger

Tool for labeling Mint transaction from Amazon purchases
MIT License
224 stars 36 forks source link

1.45: mint login dies quickly with ChromeDriver/Chrome 103 (MacOS and Linux) #107

Closed cwmoriarty closed 2 years ago

cwmoriarty commented 2 years ago
Running version 1.45
Parsing Amazon Orders |████████████████████████████████| x/x
Parsing Amazon Items |████████████████████████████████| y/y
Logging in to mint.com\

You may be asked for an auth code at the command line! Be sure to press ENTER after typing the 6 digit code.
Navigating to Mint homepage.
Traceback (most recent call last):
  File "/Users/cwm/Library/Python/3.8/bin/mint-amazon-tagger-cli", line 8, in <module>
    sys.exit(main())
  File "/Users/cwm/Library/Python/3.8/lib/python/site-packages/mintamazontagger/cli.py", line 114, in main
    results = tagger.create_updates(
  File "/Users/cwm/Library/Python/3.8/lib/python/site-packages/mintamazontagger/tagger.py", line 126, in create_updates
    if not mint_client.login():
  File "/Users/cwm/Library/Python/3.8/lib/python/site-packages/mintamazontagger/mintclient.py", line 60, in login
    self.logged_in = _nav_to_mint_and_login(
  File "/Users/cwm/Library/Python/3.8/lib/python/site-packages/mintamazontagger/mintclient.py", line 199, in _nav_to_mint_and_login
    webdriver.get(MINT_HOME)
  File "/Users/cwm/Library/Python/3.8/lib/python/site-packages/selenium/webdriver/remote/webdriver.py", line 442, in get
    self.execute(Command.GET, {'url': url})
  File "/Users/cwm/Library/Python/3.8/lib/python/site-packages/selenium/webdriver/remote/webdriver.py", line 430, in execute
    self.error_handler.check_response(response)
  File "/Users/cwm/Library/Python/3.8/lib/python/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot determine loading status
from unknown error: unexpected command response
  (Session info: chrome=103.0.5060.53)

I've tried variations of --mint_user_will_login, --mint_mfa_preferred_method sms, and --mint_login_timeout 999. chrome closes before I can even clear cookies!

cwmoriarty commented 2 years ago

Chrome and ChromeDriver are both 103.0.5060.53

Following https://stackoverflow.com/questions/59489803/selenium-common-exceptions-webdriverexception-message-unknown-error-failed-to I may downgrade both to 102 next if I have time.

cwmoriarty commented 2 years ago

Strangely, Amazon had no issues...

cwmoriarty commented 2 years ago

Got this working by setting LATEST_RELEASE_102 in https://github.com/jprouty/mint-amazon-tagger/blob/53c5715c713108a2a5c067dccbfff07942bd53ad/mintamazontagger/webdriver.py#L101 and letting it downgrade

jprouty commented 2 years ago

Thanks for the report. I am able to repro on Win10 as well. Ironically everything was working hunky dory for me yesterday and today I get the 103 update from chromium stable channel 👍 I'll look into the underlying issue a bit more, and consider your work around as well (thanks for that).

jprouty commented 2 years ago

Okay, I think I have a better fix: leave the version logic alone (use 103) but add a workaround (introducing a 1 second sleep between getting the webdriver and starting the mint login flow. Please reopen if this doesn't work for you or you need more assistance. I'll cut release 1.46 to include this, since others will likely hit this too. Thanks for the quick report!

jprouty commented 2 years ago

I'm guessing this is the underlying chromedriver issue, which sounds like it will be fixed in chromedriver 104 (aka, in 4 weeks time).

cwmoriarty commented 2 years ago

Can still repro in 1.46 on MacOS.


Running version 1.46
Parsing Amazon Orders |████████████████████████████████| x/x
Parsing Amazon Items |████████████████████████████████| y/y
Logging in to mint.com\

You may be asked for an auth code at the command line! Be sure to press ENTER after typing the 6 digit code.
Navigating to Mint homepage.
Clicking "Sign in" button.
Traceback (most recent call last):
  File "/Users/cwm/Library/Python/3.8/bin/mint-amazon-tagger-cli", line 8, in <module>
    sys.exit(main())
  File "/Users/cwm/Library/Python/3.8/lib/python/site-packages/mintamazontagger/cli.py", line 114, in main
    results = tagger.create_updates(
  File "/Users/cwm/Library/Python/3.8/lib/python/site-packages/mintamazontagger/tagger.py", line 126, in create_updates
    if not mint_client.login():
  File "/Users/cwm/Library/Python/3.8/lib/python/site-packages/mintamazontagger/mintclient.py", line 60, in login
    self.logged_in = _nav_to_mint_and_login(
  File "/Users/cwm/Library/Python/3.8/lib/python/site-packages/mintamazontagger/mintclient.py", line 207, in _nav_to_mint_and_login
    sign_in_button.click()
  File "/Users/cwm/Library/Python/3.8/lib/python/site-packages/selenium/webdriver/remote/webelement.py", line 89, in click
    self._execute(Command.CLICK_ELEMENT)
  File "/Users/cwm/Library/Python/3.8/lib/python/site-packages/selenium/webdriver/remote/webelement.py", line 773, in _execute
    return self._parent.execute(command, params)
  File "/Users/cwm/Library/Python/3.8/lib/python/site-packages/selenium/webdriver/remote/webdriver.py", line 430, in execute
    self.error_handler.check_response(response)
  File "/Users/cwm/Library/Python/3.8/lib/python/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot determine loading status
from unknown error: unexpected command response
  (Session info: chrome=103.0.5060.53)
jprouty commented 2 years ago

Thanks for the follow-up. I've come up with a better workaround after investigating the issue a bit deeper. I was able to get it to happen on nearly any website, when using a new chrome session. It seems to depend on the complexity of the site & if that site has been cached/visited before for the given chrome session. In any case, I've added a loop that catches the exception in question with a 1 sec sleep, allowing webdriver some time to get ready. v1.47 should work better for you. Thanks!