@@ -48,19 +48,28 @@ def wait_for_ready_state_complete(driver, timeout=settings.LARGE_TIMEOUT):
4848 return False # readyState stayed "interactive" (Not "complete")
4949
5050
51- def execute_async_script (driver , script , timeout = settings .EXTREME_TIMEOUT ):
51+ def execute_async_script (driver , script , timeout = settings .LARGE_TIMEOUT ):
5252 driver .set_script_timeout (timeout )
5353 return driver .execute_async_script (script )
5454
5555
5656def wait_for_angularjs (driver , timeout = settings .LARGE_TIMEOUT , ** kwargs ):
5757 if hasattr (settings , "SKIP_JS_WAITS" ) and settings .SKIP_JS_WAITS :
5858 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
5969 if not settings .WAIT_FOR_ANGULARJS :
6070 return
6171 if timeout == settings .MINI_TIMEOUT :
62- timeout = settings .MINI_TIMEOUT / 2.0
63-
72+ timeout = settings .MINI_TIMEOUT / 4.0
6473 NG_WRAPPER = (
6574 "%(prefix)s"
6675 "var $elm=document.querySelector("
@@ -84,15 +93,10 @@ def wait_for_angularjs(driver, timeout=settings.LARGE_TIMEOUT, **kwargs):
8493 "handler" : handler ,
8594 "suffix" : suffix ,
8695 }
87- try :
88- # This closes any pop-up alerts (otherwise the next part fails)
89- driver .execute_script ("" )
90- except Exception :
91- pass
9296 try :
9397 execute_async_script (driver , script , timeout = timeout )
9498 except Exception :
95- time .sleep (0.05 )
99+ time .sleep (0.0456 )
96100
97101
98102def convert_to_css_selector (selector , by = By .CSS_SELECTOR ):
0 commit comments