Пример #1
0
 def wait_until_loaded(self, timeout=DEFAULT_TIMEOUT, polling_time=DEFAULT_POLLING_TIME):
     self.timeout = timeout
     self.polling_time = polling_time
     wait = Wait(self.timeout, self.polling_time)\
         .with_ignored_exceptions(StaleElementReferenceException)
     if len(self.traits) == 0:
         raise IllegalStateException("Element '{0}' has no traits".format(self.name))
     else:
         wait.until_traits_are_present(self)
         return self
Пример #2
0
 def wait_until_loaded(self,
                       timeout=DEFAULT_TIMEOUT,
                       polling_time=DEFAULT_POLLING_TIME):
     self.timeout = timeout
     self.polling_time = polling_time
     wait = Wait(self.timeout, self.polling_time)\
         .with_ignored_exceptions(StaleElementReferenceException)
     if len(self.traits) == 0:
         raise IllegalStateException("Element '{0}' has no traits".format(
             self.name))
     else:
         wait.until_traits_are_present(self)
         return self
Пример #3
0
 def test_wait_until_raises_TimeoutException(self):
     assert_that(calling(Wait(0).until_condition).with_args(always_false, 'always false'), raises(TimeoutException))
Пример #4
0
 def test_wait_until_returns_evaluated_value(self):
     wait_until = Wait(1).until_condition(function, 'always true')
     assert_that(wait_until, equal_to('the value'))
Пример #5
0
 def test_wait_until_gives_an_exceptions_for_a_non_callable(self):
     assert_that(calling(Wait(1).until_condition).with_args(function(), 'a non callable'), raises(TypeError))
Пример #6
0
 def test_ignored_exceptions_can_be_iterable(self):
     wait = Wait(1).with_ignored_exceptions(FirstException, SecondException)
     assert_that(wait._ignored_exceptions, equal_to((NoSuchElementException, FirstException, SecondException)))
Пример #7
0
 def test_ignored_exceptions_can_be_not_iterable(self):
     wait = Wait(1, ignored_exceptions=FirstException)
     assert_that(wait._ignored_exceptions, equal_to((NoSuchElementException, FirstException)))
Пример #8
0
 def test_set_driver(self):
     driver = MockedWebDriver()
     wait = Wait(10).with_driver(driver)
     assert_that(wait._driver.session_id, equal_to(driver.session_id))
Пример #9
0
 def test_set_poll_interval(self):
     wait = Wait(10).with_poll_interval(1)
     assert_that(wait._poll, equal_to(1), 'poll interval can be set')
Пример #10
0
 def test_set_time_out(self):
     wait = Wait(1).with_timeout(10)
     assert_that(wait._timeout, equal_to(10), 'timeout can be set')