def wait_to(webdriver_condition, timeout=None, polling=None): if timeout is None: timeout = selene.config.timeout if polling is None: polling = selene.config.poll_during_waits return wait_for(driver(), webdriver_condition, timeout, polling)
def find(self): # webelements = self._collection() webelements = wait_for(self._collection, have.size_at_least(self._slice.stop), config.timeout, config.poll_during_waits) return webelements[self._slice.start:self._slice.stop:self._slice.step]
def find(self): # return self._collection.get_actual_webelements()[self._index] return wait_for( self._collection, have.size_at_least(self._index + 1), config.timeout, config.poll_during_waits)[self._index]
def should(self, condition, timeout=None): if timeout is None: timeout = config.timeout # todo: implement proper cashing self._found = wait_for(self, condition, timeout) #_wait_with_screenshot(self._webdriver, self, condition, timeout) return self
def wait_to(webdriver_condition, timeout=None, polling=None): warnings.warn( "use selene.browser.wait_to(webdriver_condition, timeout, polling) instead", DeprecationWarning) if timeout is None: timeout = selene.config.timeout if polling is None: polling = selene.config.poll_during_waits return wait_for(get_driver(), webdriver_condition, timeout, polling)
def _wait_with_screenshot(webdriver, entity, condition, timeout=None, polling=None): if timeout is None: timeout = config.timeout if polling is None: polling = config.poll_during_waits try: return wait_for(entity, condition, timeout, polling) except TimeoutException as e: screenshot = helpers.take_screenshot(webdriver, ) msg = '''{original_msg} screenshot: file://{screenshot}'''.format(original_msg=e.msg, screenshot=screenshot) raise TimeoutException(msg, e.screen, e.stacktrace)
def find(self): # return self._element.get_actual_webelement().find_element(*self._by) return wait_for(self._element, be.visible, config.timeout, config.poll_during_waits).find_element(*self._by)
def assure(self, condition, timeout=None): if not timeout: timeout = config.timeout self.found = wait_for(self, condition, condition, timeout) # self.found = self.finder() # todo: duplicated? return self
def assure(self, condition, timeout=None): if not timeout: timeout = config.timeout self._found = wait_for(self, condition, condition, timeout) return self
def should(webdriver_condition, timeout=None, polling=None): return wait_for(webdriver_condition, timeout, polling)
def wait_for_element(selector, visible=True, timeout=20): if visible: wait_for(get_element(selector), be.visible, timeout=timeout) else: wait_for(get_element(selector), be.not_(be.visible), timeout=timeout)