Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions newsfragments/1496.change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Set Chrome's page load strategy to ``eager``, so that navigation does not
wait for images and third-party scripts which no operation in this
package needs.
7 changes: 7 additions & 0 deletions src/vws_web_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@
def create_chrome_driver() -> WebDriver:
"""Create a headless Chrome WebDriver."""
options = ChromeOptions()
# Return from ``driver.get`` once the DOM is ready, without waiting
# for sub-resources. Every element this package looks for is behind
# an explicit wait, and ``wait_for_logged_in`` asks for
# ``document.readyState`` where a full load is what matters, so
# waiting for images and analytics scripts to load only adds time
# and turns slow third-party requests into timeouts.
options.page_load_strategy = "eager" # noqa: V101
options.add_argument(argument="--headless=new")
options.add_argument(argument="--no-sandbox")
options.add_argument(argument="--disable-dev-shm-usage")
Expand Down
Loading