MCPcopy Index your code
hub / github.com/seleniumbase/SeleniumBase / highlight

Method highlight

seleniumbase/fixtures/base_case.py:6720–6757  ·  view source on GitHub ↗

This method uses fancy JavaScript to highlight an element. @Params selector - the selector of the element to find (Accepts WebElement) by - the type of selector to search by (Default: CSS) loops - # of times to repeat the highlight animation (Default:

(
        self,
        selector,
        by="css selector",
        loops=None,
        scroll=True,
        timeout=None,
    )

Source from the content-addressed store, hash-verified

6718 time.sleep(0.065)
6719
6720 def highlight(
6721 self,
6722 selector,
6723 by="css selector",
6724 loops=None,
6725 scroll=True,
6726 timeout=None,
6727 ):
6728 """This method uses fancy JavaScript to highlight an element.
6729 @Params
6730 selector - the selector of the element to find (Accepts WebElement)
6731 by - the type of selector to search by (Default: CSS)
6732 loops - # of times to repeat the highlight animation
6733 (Default: 4. Each loop lasts for about 0.2s)
6734 scroll - the option to scroll to the element first (Default: True)
6735 timeout - the time to wait for the element to appear """
6736 self.__check_scope()
6737 if self.__is_cdp_swap_needed():
6738 if page_utils.is_xpath_selector(selector):
6739 if "contains(" in selector:
6740 self.cdp.highlight(selector)
6741 return
6742 else:
6743 self._check_browser()
6744 self.__skip_if_esc()
6745 if isinstance(selector, WebElement):
6746 self.__highlight_element(selector, loops=loops, scroll=scroll)
6747 return
6748 if not timeout:
6749 timeout = settings.SMALL_TIMEOUT
6750 self.wait_for_element_visible(selector, by=by, timeout=timeout)
6751 self.__highlight(selector=selector, by=by, loops=loops, scroll=scroll)
6752 if self.recorder_mode and self.__current_url_is_recordable():
6753 if self.get_session_storage_item("pause_recorder") == "no":
6754 time_stamp = self.execute_script("return Date.now();")
6755 origin = self.get_origin()
6756 action = ["hi_li", selector, origin, time_stamp]
6757 self.__extra_actions.append(action)
6758
6759 def highlight_elements(
6760 self,

Callers

nothing calls this directly

Calls 11

__check_scopeMethod · 0.95
__is_cdp_swap_neededMethod · 0.95
_check_browserMethod · 0.95
__skip_if_escMethod · 0.95
__highlight_elementMethod · 0.95
__highlightMethod · 0.95
execute_scriptMethod · 0.95
get_originMethod · 0.95

Tested by

no test coverage detected