@@ -48,19 +48,28 @@ def wait_for_ready_state_complete(driver, timeout=settings.LARGE_TIMEOUT):
48
48
return False # readyState stayed "interactive" (Not "complete")
49
49
50
50
51
- def execute_async_script (driver , script , timeout = settings .EXTREME_TIMEOUT ):
51
+ def execute_async_script (driver , script , timeout = settings .LARGE_TIMEOUT ):
52
52
driver .set_script_timeout (timeout )
53
53
return driver .execute_async_script (script )
54
54
55
55
56
56
def wait_for_angularjs (driver , timeout = settings .LARGE_TIMEOUT , ** kwargs ):
57
57
if hasattr (settings , "SKIP_JS_WAITS" ) and settings .SKIP_JS_WAITS :
58
58
return
59
+ try :
60
+ # This closes pop-up alerts
61
+ driver .execute_script ("" )
62
+ except Exception :
63
+ 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
59
69
if not settings .WAIT_FOR_ANGULARJS :
60
70
return
61
71
if timeout == settings .MINI_TIMEOUT :
62
- timeout = settings .MINI_TIMEOUT / 2.0
63
-
72
+ timeout = settings .MINI_TIMEOUT / 4.0
64
73
NG_WRAPPER = (
65
74
"%(prefix)s"
66
75
"var $elm=document.querySelector("
@@ -84,15 +93,10 @@ def wait_for_angularjs(driver, timeout=settings.LARGE_TIMEOUT, **kwargs):
84
93
"handler" : handler ,
85
94
"suffix" : suffix ,
86
95
}
87
- try :
88
- # This closes any pop-up alerts (otherwise the next part fails)
89
- driver .execute_script ("" )
90
- except Exception :
91
- pass
92
96
try :
93
97
execute_async_script (driver , script , timeout = timeout )
94
98
except Exception :
95
- time .sleep (0.05 )
99
+ time .sleep (0.0456 )
96
100
97
101
98
102
def convert_to_css_selector (selector , by = By .CSS_SELECTOR ):
0 commit comments