Exemplo n.º 1
0
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)
Exemplo n.º 2
0
 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]
Exemplo n.º 3
0
 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]
Exemplo n.º 4
0
 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
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
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)
Exemplo n.º 7
0
 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)
Exemplo n.º 8
0
 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
Exemplo n.º 9
0
 def assure(self, condition, timeout=None):
     if not timeout:
         timeout = config.timeout
     self._found = wait_for(self, condition, condition, timeout)
     return self
Exemplo n.º 10
0
def should(webdriver_condition, timeout=None, polling=None):
    return wait_for(webdriver_condition, timeout, polling)
Exemplo n.º 11
0
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)