@@ -5508,29 +5508,50 @@ def bring_to_front(self, selector, by="css selector"):
5508
5508
self.execute_script(script)
5509
5509
5510
5510
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,
5512
5512
):
5513
5513
"""Highlights the element and then clicks it."""
5514
5514
self.__check_scope()
5515
+ if not timeout:
5516
+ timeout = settings.SMALL_TIMEOUT
5517
+ self.wait_for_element_visible(selector, by=by, timeout=timeout)
5515
5518
if not self.demo_mode:
5516
5519
self.__highlight(selector, by=by, loops=loops, scroll=scroll)
5517
5520
self.click(selector, by=by)
5518
5521
5519
5522
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,
5521
5530
):
5522
5531
"""Highlights the element and then types text into the field."""
5523
5532
self.__check_scope()
5533
+ if not timeout:
5534
+ timeout = settings.SMALL_TIMEOUT
5535
+ self.wait_for_element_visible(selector, by=by, timeout=timeout)
5524
5536
if not self.demo_mode:
5525
5537
self.__highlight(selector, by=by, loops=loops, scroll=scroll)
5526
5538
self.update_text(selector, text, by=by)
5527
5539
5528
5540
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,
5530
5548
):
5531
5549
"""Same as self.highlight_update_text()
5532
5550
As above, highlights the element and then types text into the field."""
5533
5551
self.__check_scope()
5552
+ if not timeout:
5553
+ timeout = settings.SMALL_TIMEOUT
5554
+ self.wait_for_element_visible(selector, by=by, timeout=timeout)
5534
5555
if not self.demo_mode:
5535
5556
self.__highlight(selector, by=by, loops=loops, scroll=scroll)
5536
5557
self.update_text(selector, text, by=by)
@@ -5613,15 +5634,26 @@ def __highlight(
5613
5634
pass # JQuery probably couldn't load. Skip highlighting.
5614
5635
time.sleep(0.065)
5615
5636
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
+ ):
5617
5645
"""This method uses fancy JavaScript to highlight an element.
5618
5646
@Params
5619
5647
selector - the selector of the element to find
5620
5648
by - the type of selector to search by (Default: CSS)
5621
5649
loops - # of times to repeat the highlight animation
5622
5650
(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 """
5624
5653
self.__check_scope()
5654
+ if not timeout:
5655
+ timeout = settings.SMALL_TIMEOUT
5656
+ self.wait_for_element_visible(selector, by=by, timeout=timeout)
5625
5657
self.__highlight(selector=selector, by=by, loops=loops, scroll=scroll)
5626
5658
if self.recorder_mode and self.__current_url_is_recordable():
5627
5659
if self.get_session_storage_item("pause_recorder") == "no":
0 commit comments