southwest-headers
southwest-headers copied to clipboard
[WORKAROUND] Errors encountered after upgrading to Chrome 110 [or latest undetected-chromedriver]
For the last month or so the southwest-headers script has been running fine against Chrome 109. This morning when the script ran it generated an error message saying that the undetected-chromedriver required Chrome 110. I upgraded Chrome to version 110. When running southwest-headers after upgrading to Chrome 110 the following error was generated:
Traceback (most recent call last):
File "southwest-headers.py", line 22, in <module>
driver = uc.Chrome(headless = True)
File "/home/ubuntu/southwest-headers/env/lib/python3.8/site-packages/seleniumwire/undetected_chromedriver/webdriver.py", line 61, in __init__
super().__init__(*args, **kwargs)
File "/home/ubuntu/southwest-headers/env/lib/python3.8/site-packages/undetected_chromedriver/__init__.py", line 429, in __init__
super(Chrome, self).__init__(
File "/home/ubuntu/southwest-headers/env/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
super().__init__(
File "/home/ubuntu/southwest-headers/env/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py", line 106, in __init__
super().__init__(
File "/home/ubuntu/southwest-headers/env/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 288, in __init__
self.start_session(capabilities, browser_profile)
File "/home/ubuntu/southwest-headers/env/lib/python3.8/site-packages/undetected_chromedriver/__init__.py", line 715, in start_session
super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session(
File "/home/ubuntu/southwest-headers/env/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 381, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/home/ubuntu/southwest-headers/env/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 444, in execute
self.error_handler.check_response(response)
File "/home/ubuntu/southwest-headers/env/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 249, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:55567
from unknown error: unable to discover open pages
This is the response I receive when I execute Chrome:
> google-chrome --version
Google Chrome 110.0.5481.77
Is anyone else experiencing this issue? Any help would be appreciated as I am stumped as how to move forward to resolve this issue.
I did some checking on the undetected-chromedriver repository and found the following commit (see partial screen capture below) which specifically discusses the issue "could not connect to chrome" error when running on linux using privileged user like root. In my case the script is running under root so this explanation applies. It seems that the issue has been fixex in undetected-chromedriver 3.4.5, however I am still encountering the problem when I execute the script. How can I tell which version of undetected-chromedriver is executing when the script is run? How could I ensure that the upgrade to undetected-chromedriver 3.4.5 has taken place?
Further information: I tried running the script with a non root user and still encountered the problem shown in the original post.
appreciate you digging in and looking for possible solutions. at least tonight, i'm not able to really troubleshoot this. but i will say it might be easiest to revert back to an older version of chrome. if you do that, then update this line:
https://github.com/byalextran/southwest-headers/blob/6ffa2494270c79b0239338e8f7ef798d948e1495/southwest-headers.py#L22
to something this:
driver = uc.Chrome(headless = True, version_main=108)
Replacing 108 with whatever Chrome version you reverted to.
And if you do revert, I would prevent Chrome from auto-updating. At least on DigitalOcean/Ubuntu, this is how you do that:
https://support.google.com/chrome/a/answer/9052345?hl=en#zippy=%2Cstep-turn-off-chrome-browser-updates
Thanks for getting back to me.
Before reverting to a prior version of chrome I thought I would try to resolve the problem by updating undetected-chromedriver to version 3.4.5 and it appears to have worked.
Here is what I did:
Modified line 30 of /southwest-headers/requirements.txt => undetected-chromedriver==3.4.5
Executed the following:
cd southwest-headers
rm -rf env
virtualenv env
env/bin/pip install -r requirements.txt
Then executing the southwest-headers script worked correctly.
Upon further review:
After upgrading to undetected-chromedriver v3.4.5 the southwest-headers script runs correctly and generates headers that look okay. However, when I actually use the headers to make calls to the SWA api the calls fail with the 429 error. I haven't had a chance to try an actual check in yet, the failing api calls I am referring to are calls to other SWA api endpoints. However, all of these api calls were working correctly when I was using Chrome 109 and undetected-chromedriver v3.1.7.
When I have time I am going to attempt to follow @byalextran's suggestion to revert to Chrome 109 and undetected-chromedriver v 3.1.7.
thanks for updating this thread.
given how much this script is a cat-and-mouse game with southwest (and how often chrome pushes updates that could break things with undetected-chromedriver), i would probably stick with what used to work and not upgrade anything unless you absolutely have to.
Reverted back to Chrome v109 and undetected-chromedriver v3.1.7. Replaced line 22 of southwest-headers.py with
driver = uc.Chrome(headless = True, version_main=109)
Everything is now working correctly.
Thanks @byalextran for the suggestion.
sweet, glad you got it working! i'll leave this issue open for a bit in case others run into this issue.