(self, element, loops=None, scroll=True)
| 6608 | self.__highlight(selector, by=by, loops=loops, scroll=scroll) |
| 6609 | |
| 6610 | def __highlight_element(self, element, loops=None, scroll=True): |
| 6611 | self.__check_scope() |
| 6612 | if not loops: |
| 6613 | loops = settings.HIGHLIGHTS |
| 6614 | if scroll and self.browser != "safari": |
| 6615 | with suppress(Exception): |
| 6616 | self.__slow_scroll_to_element(element) |
| 6617 | if self.highlights: |
| 6618 | loops = self.highlights |
| 6619 | if self.browser == "ie": |
| 6620 | loops = 1 # Override previous setting because IE is slow |
| 6621 | loops = int(loops) |
| 6622 | if self.headless or self.headless2 or self.xvfb: |
| 6623 | # Headless modes have less need for highlighting elements. |
| 6624 | # However, highlight() may be used as a sleep alternative. |
| 6625 | loops = int(math.ceil(loops * 0.5)) |
| 6626 | o_bs = "" # original_box_shadow |
| 6627 | try: |
| 6628 | style = element.get_attribute("style") |
| 6629 | except Exception: |
| 6630 | self.wait_for_ready_state_complete() |
| 6631 | time.sleep(0.12) |
| 6632 | style = element.get_attribute("style") |
| 6633 | if style: |
| 6634 | if "box-shadow: " in style: |
| 6635 | box_start = style.find("box-shadow: ") |
| 6636 | box_end = style.find(";", box_start) + 1 |
| 6637 | original_box_shadow = style[box_start:box_end] |
| 6638 | o_bs = original_box_shadow |
| 6639 | self.__highlight_element_with_js(element, loops, o_bs) |
| 6640 | time.sleep(0.065) |
| 6641 | |
| 6642 | def __highlight( |
| 6643 | self, selector, by="css selector", loops=None, scroll=True |
no test coverage detected