MCPcopy Index your code
hub / github.com/seleniumbase/SeleniumBase / wait_for_angularjs

Function wait_for_angularjs

seleniumbase/fixtures/js_utils.py:67–105  ·  view source on GitHub ↗
(driver, timeout=settings.LARGE_TIMEOUT, **kwargs)

Source from the content-addressed store, hash-verified

65
66
67def wait_for_angularjs(driver, timeout=settings.LARGE_TIMEOUT, **kwargs):
68 if getattr(settings, "SKIP_JS_WAITS", None):
69 return
70 with suppress(Exception):
71 # This closes pop-up alerts
72 execute_script(driver, "")
73 if (
74 getattr(driver, "_is_using_uc", None)
75 or not settings.WAIT_FOR_ANGULARJS
76 ):
77 wait_for_ready_state_complete(driver)
78 return
79 if timeout == settings.MINI_TIMEOUT:
80 timeout = settings.MINI_TIMEOUT / 6.0
81 NG_WRAPPER = (
82 "%(prefix)s"
83 "var $elm=document.querySelector("
84 "'[data-ng-app],[ng-app],.ng-scope')||document;"
85 "if(window.angular && angular.getTestability){"
86 "angular.getTestability($elm).whenStable(%(handler)s)"
87 "}else{"
88 "var $inj;try{$inj=angular.element($elm).injector()||"
89 "angular.injector(['ng'])}catch(ex){"
90 "$inj=angular.injector(['ng'])};$inj.get=$inj.get||"
91 "$inj;$inj.get('$browser')."
92 "notifyWhenNoOutstandingRequests(%(handler)s)}"
93 "%(suffix)s"
94 )
95 def_pre = "var cb=arguments[arguments.length-1];if(window.angular){"
96 prefix = kwargs.pop("prefix", def_pre)
97 handler = kwargs.pop("handler", "function(){cb(true)}")
98 suffix = kwargs.pop("suffix", "}else{cb(false)}")
99 script = NG_WRAPPER % {
100 "prefix": prefix,
101 "handler": handler,
102 "suffix": suffix,
103 }
104 with suppress(Exception):
105 execute_async_script(driver, script, timeout=timeout)
106
107
108def convert_to_css_selector(selector, by=By.CSS_SELECTOR):

Callers 4

wait_for_jquery_activeFunction · 0.85
activate_jquery_confirmFunction · 0.85
activate_html_inspectorFunction · 0.85
activate_messengerFunction · 0.85

Calls 3

execute_scriptFunction · 0.85
execute_async_scriptFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…