コード例 #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
ファイル: element_with_traits.py プロジェクト: valermor/pages
 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')