-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
This is one of those very rare issues where a page load hangs (or doesn't finish loading within a long timeout).
- Example:
Exception: timeout: Timed out receiving message from renderer: 299.702
Quite popular on StackOverflow: https://stackoverflow.com/q/48450594/7058266
There are a few ways to avoid the issue with SeleniumBase. There are some Chromium options that can help. There are some code changes that can help. Also, the default pageLoadTimeout
for Selenium is very long: 300 seconds --> 5 minutes. I've never seen a situation where waiting the full 5 minutes helped if the page still hadn't loaded within 2 minutes. Therefore, at a minimum, the default Selenium timeout for this could be lowered to 2 minutes so that hanging tests don't hang for longer than they need to.
Changing the pageLoadStrategy
could also help. The default pageLoadStrategy
is "normal"
, but a command-line option could be added to change that to "eager"
or "none"
.
Info on existing pageLoadStrategy
options:
-
"normal"
--> This strategy causes Selenium to wait for the full page loading (html content and sub resources downloaded and parsed). -
"eager"
--> This strategy causes Selenium to wait for the DOMContentLoaded event (html content downloaded and parsed only). -
"none"
--> This strategy causes Selenium to return immediately after the initial page content is fully received (html content downloaded).
Here's an example where this occurred in CI/CD:
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.TimeoutException: Message: timeout: Timed out receiving message from renderer: 299.702
E (Session info: chrome=104.0.5112.79)