MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / wait_for_element_absent

Method wait_for_element_absent

seleniumbase/core/sb_cdp.py:3042–3061  ·  view source on GitHub ↗

Wait for element to not be present in the DOM.

(self, selector, timeout=None)

Source from the content-addressed store, hash-verified

3040 )
3041
3042 def wait_for_element_absent(self, selector, timeout=None):
3043 """Wait for element to not be present in the DOM."""
3044 if not timeout:
3045 timeout = settings.SMALL_TIMEOUT
3046 start_ms = time.time() * 1000.0
3047 stop_ms = start_ms + (timeout * 1000.0)
3048 for i in range(int(timeout * 10)):
3049 if not self.is_element_present(selector):
3050 return True
3051 now_ms = time.time() * 1000.0
3052 if now_ms >= stop_ms:
3053 break
3054 time.sleep(0.1)
3055 plural = "s"
3056 if timeout == 1:
3057 plural = ""
3058 raise Exception(
3059 "Element {%s} was still present after %s second%s!"
3060 % (selector, timeout, plural)
3061 )
3062
3063 def wait_for_any_of_elements_visible(self, *args, **kwargs):
3064 """Waits for at least one of the elements to be visible.

Calls 2

is_element_presentMethod · 0.95
sleepMethod · 0.45

Tested by 1

test_presentation_4Method · 0.36