def perform_as(self, actor: Actor):
        def click_on_element(browser):
            browser.find_element(*self._locator).click()
            return True

        waiting_browser_for(actor,
                            (StaleElementReferenceException,
                             NoSuchElementException)).until(click_on_element)
    def perform_as(self, actor: Actor):
        element = None
        try:
            element = waiting_browser_for(actor, (StaleElementReferenceException, NoSuchElementException)) \
                .find_element(*self._locator)
        except TimeoutException:
            pass

        if self._id is not None:
            actor.state[self._id].set(element)

        return element
예제 #3
0
    def perform_as(self, actor: Actor):
        elements = []
        try:
            elements = waiting_browser_for(actor, (StaleElementReferenceException, NoSuchElementException)) \
                .find_elements(*self._locator)
        except TimeoutException:
            pass

        element = next((e for e in elements if e.text.strip() == self._text),
                       None)

        if self._id is not None:
            actor.state[self._id].set(element)

        return element
예제 #4
0
    def perform_as(self, actor: Actor):
        assert self._source_id is not None, "No source id specified"
        assert self._destination_id is not None, "No destination id specified"

        parent: WebElement = actor.state[self._source_id].value
        self.element = None

        def find_the_sub_element(browser):
            self.element = parent.find_element(*self._locator)
            return True

        waiting_browser = waiting_browser_for(
            actor, (StaleElementReferenceException, NoSuchElementException))
        try:
            waiting_browser.until(find_the_sub_element)
        except TimeoutException:
            pass

        if self._destination_id is not None:
            actor.state[self._destination_id].set(self.element)

        return self.element