selene icon indicating copy to clipboard operation
selene copied to clipboard

ensure element.type: types to the end (i.e. append); waits for visibility and not covered by other (like preloader cover)

Open yashaka opened this issue 4 years ago • 3 comments

Kind of just aliasing it to self.click().send_keys(keys) would help, but:

  • should we click on input all times? at least we should add a corresponding configuration option...
  • and where should we click then? start? end? when typing - we have to click at end... How to implement this? in a simple and proper way?

yashaka avatar Apr 05 '21 19:04 yashaka

I will do

rina-tenitska avatar Apr 25 '21 16:04 rina-tenitska

There was an idea to provide the following implementation

    def _actual_not_overlapped_element(self):
        element = self()

        element_html = re.sub('\\s+', ' ', element.get_attribute('outerHTML'))

        def maybe_cover():
            if not element.is_displayed():
                raise ElementNotVisibleException(
                    f'Element {element_html} is not visible'
                )

            window_position = self.config.driver.get_window_position()
            element_position_x = int(
                element.location['x']
                + window_position['x']
                + element.size['width'] / 2
            )
            element_position_y = int(
                element.location['y']
                + window_position['y']
                + element.size['height'] / 2
            )
            element_from_point: WebElement = self.config.driver.execute_script(
                '''
                return document.elementFromPoint(arguments[0], arguments[1]);
                ''',
                element_position_x,
                element_position_y,
            )

            if element == element_from_point:
                return None
            else:
                return element_from_point

        if maybe_cover() is not None:
            cover_html = re.sub(
                '\\s+', ' ', maybe_cover().get_attribute('outerHTML')
            )
            raise ElementNotInteractableException(
                f'Element {element_html} is overlapped by {cover_html}'
            )

        return element

instead something like this via js...

but the problem with "raw webdriver approach" is in much more calles via driver – that should be much less efficient in context of speed...

so we definitely have to use js for now... maybe later we can provide a "no js" option just in case... but for now - the pure js is what is needed here...

yashaka avatar Jun 19 '21 16:06 yashaka

Found PR #309 and linked to the issue. @rina-tenitska @yashaka all tests have been written for this issue? Issue can be closed?

aleksandr-kotlyar avatar Sep 18 '21 08:09 aleksandr-kotlyar