@@ -5508,29 +5508,50 @@ def bring_to_front(self, selector, by="css selector"):
55085508 self.execute_script(script)
55095509
55105510 def highlight_click(
5511- self, selector, by="css selector", loops=3, scroll=True
5511+ self, selector, by="css selector", loops=3, scroll=True, timeout=None,
55125512 ):
55135513 """Highlights the element and then clicks it."""
55145514 self.__check_scope()
5515+ if not timeout:
5516+ timeout = settings.SMALL_TIMEOUT
5517+ self.wait_for_element_visible(selector, by=by, timeout=timeout)
55155518 if not self.demo_mode:
55165519 self.__highlight(selector, by=by, loops=loops, scroll=scroll)
55175520 self.click(selector, by=by)
55185521
55195522 def highlight_update_text(
5520- self, selector, text, by="css selector", loops=3, scroll=True
5523+ self,
5524+ selector,
5525+ text,
5526+ by="css selector",
5527+ loops=3,
5528+ scroll=True,
5529+ timeout=None,
55215530 ):
55225531 """Highlights the element and then types text into the field."""
55235532 self.__check_scope()
5533+ if not timeout:
5534+ timeout = settings.SMALL_TIMEOUT
5535+ self.wait_for_element_visible(selector, by=by, timeout=timeout)
55245536 if not self.demo_mode:
55255537 self.__highlight(selector, by=by, loops=loops, scroll=scroll)
55265538 self.update_text(selector, text, by=by)
55275539
55285540 def highlight_type(
5529- self, selector, text, by="css selector", loops=3, scroll=True
5541+ self,
5542+ selector,
5543+ text,
5544+ by="css selector",
5545+ loops=3,
5546+ scroll=True,
5547+ timeout=None,
55305548 ):
55315549 """Same as self.highlight_update_text()
55325550 As above, highlights the element and then types text into the field."""
55335551 self.__check_scope()
5552+ if not timeout:
5553+ timeout = settings.SMALL_TIMEOUT
5554+ self.wait_for_element_visible(selector, by=by, timeout=timeout)
55345555 if not self.demo_mode:
55355556 self.__highlight(selector, by=by, loops=loops, scroll=scroll)
55365557 self.update_text(selector, text, by=by)
@@ -5613,15 +5634,26 @@ def __highlight(
56135634 pass # JQuery probably couldn't load. Skip highlighting.
56145635 time.sleep(0.065)
56155636
5616- def highlight(self, selector, by="css selector", loops=None, scroll=True):
5637+ def highlight(
5638+ self,
5639+ selector,
5640+ by="css selector",
5641+ loops=None,
5642+ scroll=True,
5643+ timeout=None,
5644+ ):
56175645 """This method uses fancy JavaScript to highlight an element.
56185646 @Params
56195647 selector - the selector of the element to find
56205648 by - the type of selector to search by (Default: CSS)
56215649 loops - # of times to repeat the highlight animation
56225650 (Default: 4. Each loop lasts for about 0.2s)
5623- scroll - the option to scroll to the element first (Default: True) """
5651+ scroll - the option to scroll to the element first (Default: True)
5652+ timeout - the time to wait for the element to appear """
56245653 self.__check_scope()
5654+ if not timeout:
5655+ timeout = settings.SMALL_TIMEOUT
5656+ self.wait_for_element_visible(selector, by=by, timeout=timeout)
56255657 self.__highlight(selector=selector, by=by, loops=loops, scroll=scroll)
56265658 if self.recorder_mode and self.__current_url_is_recordable():
56275659 if self.get_session_storage_item("pause_recorder") == "no":
0 commit comments