Ejemplo n.º 1
0
def get_element_with_traits_and_lazy_evaluation(value):
    an_element = ElementWithTraits('an element')
    if not value:
        an_element.with_eager_evaluation()
    an_element.add_trait(lambda: False, 'never true #1')
    an_element.add_trait(lambda: False, 'never true #2')

    return an_element
Ejemplo n.º 2
0
 def test_raises_exception_when_there_are_no_traits(self):
     element = ElementWithTraits('an_element')
     assert_that(
         calling(element.wait_until_loaded).with_args(1, 0.5),
         raises(IllegalStateException))
Ejemplo n.º 3
0
 def test_raises_timeout_when_traits_do_not_load(self):
     element = ElementWithTraits('an_element').add_trait(
         lambda: False, 'never loading')
     assert_that(
         calling(element.wait_until_loaded).with_args(1, 0.5),
         raises(TimeoutException))
Ejemplo n.º 4
0
 def test_can_wait_until_traits_are_loaded(self):
     element = ElementWithTraits('an_element').add_trait(
         lambda: True, 'always present')
     assert_that(element.wait_until_loaded(5, 1), equal_to(element))
Ejemplo n.º 5
0
 def __init__(self, driver, name):
     ElementWithTraits.__init__(self, name)
     self.driver = driver
Ejemplo n.º 6
0
 def __init__(self, driver, name, locator=None):
     ElementWithTraits.__init__(self, name)
     self.driver = driver
     self.__locator = locator
     self._web_element = None
     self.__cache = False
Ejemplo n.º 7
0
 def __init__(self, driver, name, locator=None):
     ElementWithTraits.__init__(self, name)
     self.driver = driver
     self.__locator = locator
     self._web_element = None
     self.__cache = False