Beispiel #1
0
    def __get__(self, obj, cls=None):
        """Finds an element on the DOM and returns a Selenium.WebElement.

        Getting an element's value will use Selenium to find the object on the
        DOM and return the Selenium.WebElement found with its locator.

        """
        try:
            element = self.get_element(obj)
            return element

        except NoSuchElementException as error:
            screenshot = take_screenshot(obj.browser)
            error.msg = '{0} {1}:{2} not found on {3}. Screenshot: {4}'\
                .format(
                    error.msg,
                    self.__class__.__name__,
                    self.locator,
                    cls.__name__,
                    screenshot)
            raise error
Beispiel #2
0
 def __init__(self_, *args, **kwargs):
     take_screenshot(browser=self.browser, fname=self.id())
     return super(MyFailureException, self_).\
         __init__(*args, **kwargs)
Beispiel #3
0
 def __init__(self_, *args, **kwargs):
     take_screenshot(browser=self.browser, fname=self.id())
     return super(MyFailureException, self_).\
         __init__(*args, **kwargs)