From b91878f06e010246620a05877df15afecaea83db Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Thu, 18 Jun 2026 03:40:12 -0400 Subject: [PATCH] [UPD] script selenium lib: refresh can wait finish loading --- script/selenium/selenium_lib.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/script/selenium/selenium_lib.py b/script/selenium/selenium_lib.py index d0fe0f0..13d9547 100644 --- a/script/selenium/selenium_lib.py +++ b/script/selenium/selenium_lib.py @@ -1101,8 +1101,13 @@ class SeleniumLib(object): # Switch to the new window and open new URL self.driver.switch_to.window(self.driver.window_handles[index]) - def refresh(self): + def refresh(self, wait_ready=False): self.driver.refresh() + if wait_ready: + WebDriverWait(self.driver, 15).until( + lambda d: d.execute_script("return document.readyState") + == "complete" + ) def check_bot_chat_and_close(self): try: @@ -2012,9 +2017,11 @@ class SeleniumLib(object): def print_download_file_unique(self, dct_document, detect_error=False): dct_output = {"document": dct_document, "has_error": detect_error} + print() print("=DATA=") print(json.dumps(dct_output)) print("=ENDDATA=") + print() def get_args(parser):