Refactor an import location

This commit is contained in:
Michael Mintz 2021-10-31 01:57:20 -04:00
parent bbabd09aa7
commit faa714ba20
1 changed files with 5 additions and 2 deletions

View File

@ -10,7 +10,6 @@ from selenium.common.exceptions import WebDriverException
from seleniumbase import config as sb_config from seleniumbase import config as sb_config
from seleniumbase.config import settings from seleniumbase.config import settings
from seleniumbase.fixtures import constants from seleniumbase.fixtures import constants
from seleniumbase.fixtures import shared_utils
def wait_for_ready_state_complete(driver, timeout=settings.LARGE_TIMEOUT): def wait_for_ready_state_complete(driver, timeout=settings.LARGE_TIMEOUT):
@ -24,10 +23,14 @@ def wait_for_ready_state_complete(driver, timeout=settings.LARGE_TIMEOUT):
because readyState == "interactive" may be good enough. because readyState == "interactive" may be good enough.
(Previously, tests would fail immediately if exceeding the timeout.) (Previously, tests would fail immediately if exceeding the timeout.)
""" """
if sb_config.time_limit and not sb_config.recorder_mode:
from seleniumbase.fixtures import shared_utils
start_ms = time.time() * 1000.0 start_ms = time.time() * 1000.0
stop_ms = start_ms + (timeout * 1000.0) stop_ms = start_ms + (timeout * 1000.0)
for x in range(int(timeout * 10)): for x in range(int(timeout * 10)):
shared_utils.check_if_time_limit_exceeded() if sb_config.time_limit and not sb_config.recorder_mode:
shared_utils.check_if_time_limit_exceeded()
try: try:
ready_state = driver.execute_script("return document.readyState") ready_state = driver.execute_script("return document.readyState")
except WebDriverException: except WebDriverException: