(self, selector, timeout=None)
| 1583 | return coordinates |
| 1584 | |
| 1585 | def get_element_rect(self, selector, timeout=None): |
| 1586 | if not timeout: |
| 1587 | timeout = settings.SMALL_TIMEOUT |
| 1588 | selector = self.__convert_to_css_if_xpath(selector) |
| 1589 | element = self.select(selector, timeout=timeout) |
| 1590 | self.__add_light_pause() |
| 1591 | coordinates = None |
| 1592 | if ":contains(" in selector: |
| 1593 | position = element.get_position() |
| 1594 | x = position.x |
| 1595 | y = position.y |
| 1596 | width = position.width |
| 1597 | height = position.height |
| 1598 | coordinates = {"x": x, "y": y, "width": width, "height": height} |
| 1599 | else: |
| 1600 | coordinates = self.loop.run_until_complete( |
| 1601 | self.page.js_dumps( |
| 1602 | """document.querySelector('%s').getBoundingClientRect()""" |
| 1603 | % js_utils.escape_quotes_if_needed(re.escape(selector)) |
| 1604 | ) |
| 1605 | ) |
| 1606 | return coordinates |
| 1607 | |
| 1608 | def get_element_size(self, selector, timeout=None): |
| 1609 | if not timeout: |
no test coverage detected