alfonsrv/impf-botpy

An unexpected exception occurred in <control_appointment>

Closed this issue · 5 comments

Describe the issue

Terminal throws the following exception from time to time.
After some minutes the script starts again.

2021-05-23 14:22:03,642 - [ERROR] impf.browser.decorators.py:79 68163: An unexpected exception occurred in <control_appointment>!
Traceback (most recent call last):
File "/Users/marco/Apps/impf-botpy-main/impf/decorators.py", line 61, in func
return f(self, *args, **kwargs)
File "/Users/marco/Apps/impf-botpy-main/impf/browser.py", line 440, in control_appointment
self.rescan_appointments()
File "/Users/marco/Apps/impf-botpy-main/impf/browser.py", line 364, in rescan_appointments
rescan = self.wait.until(EC.presence_of_element_located((By.XPATH, f'//a[contains(text(), "hier")]')))
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/support/wait.py", line 71, in until
value = method(self._driver)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/support/expected_conditions.py", line 64, in call
return _find_element(driver, self.locator)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/support/expected_conditions.py", line 415, in _find_element
raise e
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/support/expected_conditions.py", line 411, in _find_element
return driver.find_element(*by)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element
return self.execute(Command.FIND_ELEMENT, {
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: disconnected: not connected to DevTools
(Session info: chrome=90.0.4430.212)

2021-05-23 14:22:13,644 - [INFO] <main.main.py:95> Waiting until 14:27:13 before checking the next location

Versions

MacOS BigSur 11.3.1
impf-botpy-main 0.4
Python 3.9.5
Chrome 90.0.4430.212 (Offizieller Build) (x86_64)
ChromeDriver 90.0.4430.24

ChromeDriver Binary is stored in the impf-botby-main folder and the path configured in settings.py.

Hey Marco, thanks for reporting this.

It seems like this is an issue with Selenium occasionally loosing connection to Chrome on macOS. You can try to avoid actively using Chrome when running the bot as your main browser and see if that fixes it for you.

I'm afraid there's not much else we can do as macOS is always a bit special, heh. Alternatively you can setup an Ubuntu or Windows machine if you plan using the bot over extended periods of time as the connection between Chrome and Selenium is rock-solid there from my experience.

Thank you for fast response.

It seems that the connection from Selenium to Chrome sets up automatically again. If this is not a parsing error, I think, the issue is not dramatical. It happens not often. I have seen it two times since yesterday evening.

The bot re-establishes the connection automatically by re-initializing the Browser. However this can still be undesirable as it leads to a gap in the appointment monitoring.

Hm... as I do not have the possibility to setup a linux or windows system on shortterm I do have to accept this issue. I hope that is will break will not caused if new appointments are available.

You could use the 14-days of Parallels Desktop trial. Should be enough. Otherwise just make sure to configure KEEP_BROWSER_CRASH = True