I'm using Python Selenium with Chromedriver. Every once in a while, a webdriver.get()
call will throw a TimeoutException
. I'm successfully catching every other exception through explicit waits, but the TimeoutException
seems to occur when the network stream gets dropped.
What I want to do is modify the webdriver.get()
method (through overrides or subclassing) so that every time my application calls get()
, it will automatically:
- Catch and handle
TimeoutException
- Retry the
get()
request a few times
How do I accomplish this?
Note: This question is not a duplicate of How to set the timeout of 'driver.get' for python selenium 3.8.0? -- I'm trying to add implicit functionality to the get() method. The reason I don't just wrap my get() calls in a try/except block manually is because I'm making a lot of them througout my application and am attempting to be DRY.