@@ -113,7 +113,12 @@ def open(self, url):
113
113
if url .startswith ("://" ):
114
114
# Convert URLs such as "://google.com" into "https://google.com"
115
115
url = "https" + url
116
- self .driver .get (url )
116
+ if self .browser == "safari" and url .startswith ("data:" ):
117
+ url = re .escape (url )
118
+ url = self .__escape_quotes_if_needed (url )
119
+ self .execute_script ("window.location.href='%s';" % url )
120
+ else :
121
+ self .driver .get (url )
117
122
if settings .WAIT_FOR_RSC_ON_PAGE_LOADS :
118
123
self .wait_for_ready_state_complete ()
119
124
self .__demo_mode_pause_if_active ()
@@ -241,15 +246,15 @@ def double_click(self, selector, by=By.CSS_SELECTOR, timeout=None):
241
246
self .__demo_mode_highlight_if_active (original_selector , original_by )
242
247
if not self .demo_mode and not self .slow_mode :
243
248
self .__scroll_to_element (element , selector , by )
249
+ self .wait_for_ready_state_complete ()
250
+ # Find the element one more time in case scrolling hid it
251
+ element = page_actions .wait_for_element_visible (
252
+ self .driver , selector , by , timeout = timeout )
244
253
pre_action_url = self .driver .current_url
245
254
try :
246
- actions = ActionChains (self .driver )
247
- actions .double_click (element ).perform ()
248
- except (StaleElementReferenceException , ENI_Exception ):
249
- self .wait_for_ready_state_complete ()
250
- time .sleep (0.16 )
251
- element = page_actions .wait_for_element_visible (
252
- self .driver , selector , by , timeout = timeout )
255
+ if self .browser == "safari" :
256
+ # Jump to the "except" block where the other script should work
257
+ raise Exception ("This Exception will be caught." )
253
258
actions = ActionChains (self .driver )
254
259
actions .double_click (element ).perform ()
255
260
except Exception :
@@ -549,24 +554,17 @@ def get_locale_code(self):
549
554
def go_back (self ):
550
555
self .__check_scope ()
551
556
self .__last_page_load_url = None
552
- if self .browser != "safari" :
553
- self .driver .back ()
554
- else :
555
- self .sleep (0.05 )
556
- self .execute_script ("window.location=document.referrer;" )
557
- self .sleep (0.05 )
557
+ self .driver .back ()
558
+ if self .browser == "safari" :
559
+ self .wait_for_ready_state_complete ()
560
+ self .driver .refresh ()
558
561
self .wait_for_ready_state_complete ()
559
562
self .__demo_mode_pause_if_active ()
560
563
561
564
def go_forward (self ):
562
565
self .__check_scope ()
563
566
self .__last_page_load_url = None
564
- if self .browser != "safari" :
565
- self .driver .forward ()
566
- else :
567
- self .sleep (0.05 )
568
- self .execute_script ("window.history.forward();" )
569
- self .sleep (0.05 )
567
+ self .driver .forward ()
570
568
self .wait_for_ready_state_complete ()
571
569
self .__demo_mode_pause_if_active ()
572
570
@@ -6746,7 +6744,7 @@ def setUp(self, masterqa_mode=False):
6746
6744
self .driver = sb_config .shared_driver
6747
6745
self ._drivers_list = [sb_config .shared_driver ]
6748
6746
url = self .get_current_url ()
6749
- if len ( url ) > 3 :
6747
+ if url is not None :
6750
6748
has_url = True
6751
6749
if self ._crumbs :
6752
6750
self .driver .delete_all_cookies ()
0 commit comments