Every line of 'waitforelementpresent' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
227 def waitForElements(self, css_selector, timeout=DEFAULT_WAIT_TIMEOUT, 228 visible=None): 229 """ Waits for DOM elements matching the provided CSS selector to be 230 available. 231 232 Args: 233 - css_selector: CSS selector string 234 235 Kwargs: 236 - timeout: Operation timeout in seconds 237 - visible: Ensure elements visibility status: 238 * True: wait for visible elements only 239 * False: wait for invisible elements only 240 * None: skip visibility status checks 241 242 Returns: List of DOM elements 243 """ 244 def get_element_checker(driver, visible): 245 locator = (By.CSS_SELECTOR, css_selector) 246 if visible is True: 247 return EC.visibility_of_element_located(locator) 248 if visible is False: 249 return EC.invisibility_of_element_located(locator) 250 return lambda _: driver.find_elements_by_css_selector(css_selector) 251 252 message = u"Couldn't find elems matching %s (visibility check: %s)" % ( 253 css_selector, visible) 254 WebDriverWait(self, timeout, poll_frequency=.25).until( 255 get_element_checker(self, visible), message=message) 256 257 return self.find_elements_by_css_selector(css_selector)
171 def waitVisible(css:str,timeOut:float=60, poll_frequency:float=3.0) -> WebElement: 172 global driver 173 wait = WebDriverWait(driver, timeOut, poll_frequency=poll_frequency) 174 return wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR,css)))
80 def wait_on_element(driver, xpath, timeout=120): 81 num = 0 82 while is_element_present(driver, xpath) is False: 83 if num >= timeout: 84 return False 85 else: 86 num += 1 87 time.sleep(1) 88 return True
54 def wait_for_element_not_visible(self, *locator): 55 count = 0 56 while self.is_element_visible(*locator): 57 time.sleep(1) 58 count += 1 59 if count == self.timeout: 60 raise Exception(':'.join(locator) + " is still visible")
52 def wait_for(self, interval=None, timeout=None): 53 """ 54 Get a ElementWaitFor instance. 55 56 :param interval: the wait interval (in milliseconds). If None, use element's wait interval. 57 :param timeout: the wait timeout (in milliseconds). If None, use element's wait timeout. 58 """ 59 _interval = self.get_wait_interval() if interval is None else interval 60 _timeout = self.get_wait_timeout() if timeout is None else timeout 61 return ElementWaitFor(self, _interval, _timeout)
63 def check_present(): 64 present = self._is_text_present(text) 65 if not present: 66 return 67 else: 68 return error or "Text '%s' did not disappear in %s" % (text, self._format_timeout(timeout))
91 def wait_for_element_present(self, element_selector, timeout): 92 elapsed = 0 93 interval = 0.5 94 95 while (elapsed < timeout): 96 elapsed += interval 97 if self.is_element_visible(element_selector): 98 return True 99 time.sleep(interval) 100 101 return False
142 def wait_for_element_present(self, locator): 143 """ 144 Synchronization helper to wait until some element is removed from the page 145 146 :raises: ElementVisiblityTimeout 147 """ 148 for i in range(timeout_seconds): 149 if self.se.is_element_present(locator): 150 break 151 else: 152 time.sleep(1) 153 else: 154 raise ElementVisiblityTimeout("%s presence timed out" % locator) 155 return True
63 def wait_until_element_not_visible(self, locator, timeout=10): 64 ''' 65 Search element by locator and wait until it is not visible 66 ''' 67 # Remove implicit wait 68 self.driver.implicitly_wait(0) 69 # Wait for invisibility 70 WebDriverWait(self.driver, timeout).until(EC.invisibility_of_element_located(locator)) 71 # Restore implicit wait from properties 72 self.set_implicit_wait()
170 def wait_for_element(browser, locator, timeout=12, poll_frequency=0.5): 171 ''' 172 ''' 173 try: 174 element = WebDriverWait( 175 browser, timeout, poll_frequency).until( 176 expected_conditions.presence_of_element_located(locator), 177 message='Element {} could not be found.'.format(locator[1])) 178 wait_for_ajax(browser, poll_frequency=poll_frequency) 179 return element 180 except TimeoutException as err: 181 print( 182 '{}: Waiting for element "{}" to display. {}'.format( 183 type(err).__name__, 184 locator[1], 185 err 186 )) 187 return None