Skip to content

Commit 86f7fa0

Browse files
committed
Update AngularJS waiting settings
1 parent d8b4447 commit 86f7fa0

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

examples/custom_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
# Called after self.click(selector), NOT element.click()
4949
WAIT_FOR_RSC_ON_CLICKS = False
5050
# Wait for AngularJS calls to complete after various browser actions.
51-
WAIT_FOR_ANGULARJS = False
51+
WAIT_FOR_ANGULARJS = True
5252
# Skip ALL calls to wait_for_ready_state_complete() and wait_for_angularjs().
5353
SKIP_JS_WAITS = False
5454

seleniumbase/config/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
# Called after self.click(selector), NOT element.click()
7676
WAIT_FOR_RSC_ON_CLICKS = False
7777
# Wait for AngularJS calls to complete after various browser actions.
78-
WAIT_FOR_ANGULARJS = False
78+
WAIT_FOR_ANGULARJS = True
7979
# Skip all calls to wait_for_ready_state_complete() and wait_for_angularjs().
8080
SKIP_JS_WAITS = False
8181

seleniumbase/fixtures/js_utils.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def wait_for_ready_state_complete(driver, timeout=settings.LARGE_TIMEOUT):
3838
time.sleep(0.03)
3939
return True
4040
if ready_state == "complete":
41-
time.sleep(0.01) # Better be sure everything is done loading
41+
time.sleep(0.002)
4242
return True
4343
else:
4444
now_ms = time.time() * 1000.0
@@ -61,15 +61,14 @@ def wait_for_angularjs(driver, timeout=settings.LARGE_TIMEOUT, **kwargs):
6161
driver.execute_script("")
6262
except Exception:
6363
pass
64-
if hasattr(driver, "_is_using_uc") and driver._is_using_uc:
65-
# Calling AngularJS waits may make UC Mode detectable.
66-
# Instead, pause for a brief moment, and then return.
67-
time.sleep(0.007)
68-
return
69-
if not settings.WAIT_FOR_ANGULARJS:
64+
if (
65+
(hasattr(driver, "_is_using_uc") and driver._is_using_uc)
66+
or not settings.WAIT_FOR_ANGULARJS
67+
):
68+
wait_for_ready_state_complete(driver)
7069
return
7170
if timeout == settings.MINI_TIMEOUT:
72-
timeout = settings.MINI_TIMEOUT / 4.0
71+
timeout = settings.MINI_TIMEOUT / 6.0
7372
NG_WRAPPER = (
7473
"%(prefix)s"
7574
"var $elm=document.querySelector("
@@ -96,7 +95,7 @@ def wait_for_angularjs(driver, timeout=settings.LARGE_TIMEOUT, **kwargs):
9695
try:
9796
execute_async_script(driver, script, timeout=timeout)
9897
except Exception:
99-
time.sleep(0.0456)
98+
pass
10099

101100

102101
def convert_to_css_selector(selector, by=By.CSS_SELECTOR):

0 commit comments

Comments
 (0)