@@ -89,6 +89,8 @@ def click(self, selector, by=By.CSS_SELECTOR,
89
89
element = page_actions .wait_for_element_visible (
90
90
self .driver , selector , by , timeout = timeout )
91
91
self ._demo_mode_highlight_if_active (selector , by )
92
+ if not self .demo_mode :
93
+ self ._scroll_to_element (element )
92
94
pre_action_url = self .driver .current_url
93
95
try :
94
96
element .click ()
@@ -115,6 +117,8 @@ def double_click(self, selector, by=By.CSS_SELECTOR,
115
117
element = page_actions .wait_for_element_visible (
116
118
self .driver , selector , by , timeout = timeout )
117
119
self ._demo_mode_highlight_if_active (selector , by )
120
+ if not self .demo_mode :
121
+ self ._scroll_to_element (element )
118
122
pre_action_url = self .driver .current_url
119
123
try :
120
124
actions = ActionChains (self .driver )
@@ -330,6 +334,8 @@ def add_text(self, selector, new_value, by=By.CSS_SELECTOR,
330
334
element = self .wait_for_element_visible (
331
335
selector , by = by , timeout = timeout )
332
336
self ._demo_mode_highlight_if_active (selector , by )
337
+ if not self .demo_mode :
338
+ self ._scroll_to_element (element )
333
339
pre_action_url = self .driver .current_url
334
340
try :
335
341
if not new_value .endswith ('\n ' ):
@@ -381,6 +387,8 @@ def update_text_value(self, selector, new_value, by=By.CSS_SELECTOR,
381
387
element = self .wait_for_element_visible (
382
388
selector , by = by , timeout = timeout )
383
389
self ._demo_mode_highlight_if_active (selector , by )
390
+ if not self .demo_mode :
391
+ self ._scroll_to_element (element )
384
392
try :
385
393
element .clear ()
386
394
except StaleElementReferenceException :
@@ -590,6 +598,9 @@ def highlight(self, selector, by=By.CSS_SELECTOR,
590
598
def scroll_to (self , selector , by = By .CSS_SELECTOR ,
591
599
timeout = settings .SMALL_TIMEOUT ):
592
600
''' Fast scroll to destination '''
601
+ if self .demo_mode :
602
+ self .slow_scroll_to (selector , by = by , timeout = timeout )
603
+ return
593
604
if self .timeout_multiplier and timeout == settings .SMALL_TIMEOUT :
594
605
timeout = self ._get_new_timeout (timeout )
595
606
element = self .wait_for_element_visible (
@@ -613,7 +624,8 @@ def slow_scroll_to(self, selector, by=By.CSS_SELECTOR,
613
624
self ._slow_scroll_to_element (element )
614
625
615
626
def scroll_click (self , selector , by = By .CSS_SELECTOR ):
616
- self .scroll_to (selector , by = by )
627
+ # DEPRECATED - self.click() now scrolls to the element before clicking
628
+ # self.scroll_to(selector, by=by)
617
629
self .click (selector , by = by )
618
630
619
631
def click_xpath (self , xpath ):
0 commit comments