@@ -699,7 +699,9 @@ def click_link_text(self, link_text, timeout=None):
699
699
try :
700
700
self .__jquery_slow_scroll_to (link_text , by = By .LINK_TEXT )
701
701
except Exception :
702
- pass
702
+ element = self .wait_for_link_text_visible (
703
+ link_text , timeout = timeout )
704
+ self .__slow_scroll_to_element (element )
703
705
o_bs = '' # original_box_shadow
704
706
loops = settings .HIGHLIGHTS
705
707
selector = self .convert_to_css_selector (
@@ -2120,7 +2122,7 @@ def switch_to_default_driver(self):
2120
2122
2121
2123
def save_screenshot (self , name , folder = None ):
2122
2124
""" The screenshot will be in PNG format. """
2123
- self .__check_scope ()
2125
+ self .wait_for_ready_state_complete ()
2124
2126
return page_actions .save_screenshot (self .driver , name , folder )
2125
2127
2126
2128
def save_page_source (self , name , folder = None ):
@@ -2130,12 +2132,12 @@ def save_page_source(self, name, folder=None):
2130
2132
name - The file name to save the current page's HTML to.
2131
2133
folder - The folder to save the file to. (Default = current folder)
2132
2134
"""
2133
- self .__check_scope ()
2135
+ self .wait_for_ready_state_complete ()
2134
2136
return page_actions .save_page_source (self .driver , name , folder )
2135
2137
2136
2138
def save_cookies (self , name = "cookies.txt" ):
2137
2139
""" Saves the page cookies to the "saved_cookies" folder. """
2138
- self .__check_scope ()
2140
+ self .wait_for_ready_state_complete ()
2139
2141
cookies = self .driver .get_cookies ()
2140
2142
json_cookies = json .dumps (cookies )
2141
2143
if name .endswith ('/' ):
@@ -2158,7 +2160,7 @@ def save_cookies(self, name="cookies.txt"):
2158
2160
2159
2161
def load_cookies (self , name = "cookies.txt" ):
2160
2162
""" Loads the page cookies from the "saved_cookies" folder. """
2161
- self .__check_scope ()
2163
+ self .wait_for_ready_state_complete ()
2162
2164
if name .endswith ('/' ):
2163
2165
raise Exception ("Invalid filename for Cookies!" )
2164
2166
if '/' in name :
@@ -2183,13 +2185,13 @@ def load_cookies(self, name="cookies.txt"):
2183
2185
def delete_all_cookies (self ):
2184
2186
""" Deletes all cookies in the web browser.
2185
2187
Does NOT delete the saved cookies file. """
2186
- self .__check_scope ()
2188
+ self .wait_for_ready_state_complete ()
2187
2189
self .driver .delete_all_cookies ()
2188
2190
2189
2191
def delete_saved_cookies (self , name = "cookies.txt" ):
2190
2192
""" Deletes the cookies file from the "saved_cookies" folder.
2191
2193
Does NOT delete the cookies from the web browser. """
2192
- self .__check_scope ()
2194
+ self .wait_for_ready_state_complete ()
2193
2195
if name .endswith ('/' ):
2194
2196
raise Exception ("Invalid filename for Cookies!" )
2195
2197
if '/' in name :
@@ -2259,7 +2261,7 @@ def install_addon(self, xpi_file):
2259
2261
""" Installs a Firefox add-on instantly at run-time.
2260
2262
@Params
2261
2263
xpi_file - A file archive in .xpi format. """
2262
- self .__check_scope ()
2264
+ self .wait_for_ready_state_complete ()
2263
2265
if self .browser != "firefox" :
2264
2266
raise Exception (
2265
2267
"install_addon(xpi_file) is for Firefox ONLY!\n "
@@ -2271,20 +2273,20 @@ def install_addon(self, xpi_file):
2271
2273
def activate_design_mode (self ):
2272
2274
# Activate Chrome's Design Mode, which lets you edit a site directly.
2273
2275
# See: https://twitter.com/sulco/status/1177559150563344384
2274
- self .__check_scope ()
2276
+ self .wait_for_ready_state_complete ()
2275
2277
script = ("""document.designMode = 'on';""" )
2276
2278
self .execute_script (script )
2277
2279
2278
2280
def deactivate_design_mode (self ):
2279
2281
# Deactivate Chrome's Design Mode.
2280
- self .__check_scope ()
2282
+ self .wait_for_ready_state_complete ()
2281
2283
script = ("""document.designMode = 'off';""" )
2282
2284
self .execute_script (script )
2283
2285
2284
2286
def activate_jquery (self ):
2285
2287
""" If "jQuery is not defined", use this method to activate it for use.
2286
2288
This happens because jQuery is not always defined on web sites. """
2287
- self .__check_scope ()
2289
+ self .wait_for_ready_state_complete ()
2288
2290
js_utils .activate_jquery (self .driver )
2289
2291
self .wait_for_ready_state_complete ()
2290
2292
@@ -2356,7 +2358,7 @@ def highlight(self, selector, by=By.CSS_SELECTOR,
2356
2358
self .__slow_scroll_to_element (element )
2357
2359
else :
2358
2360
self .__jquery_slow_scroll_to (selector , by )
2359
- except ( StaleElementReferenceException , ENI_Exception , JS_Exc ) :
2361
+ except Exception :
2360
2362
self .wait_for_ready_state_complete ()
2361
2363
time .sleep (0.12 )
2362
2364
element = self .wait_for_element_visible (
@@ -2405,11 +2407,11 @@ def highlight(self, selector, by=By.CSS_SELECTOR,
2405
2407
time .sleep (0.065 )
2406
2408
2407
2409
def __highlight_with_js (self , selector , loops , o_bs ):
2408
- self .__check_scope ()
2410
+ self .wait_for_ready_state_complete ()
2409
2411
js_utils .highlight_with_js (self .driver , selector , loops , o_bs )
2410
2412
2411
2413
def __highlight_with_jquery (self , selector , loops , o_bs ):
2412
- self .__check_scope ()
2414
+ self .wait_for_ready_state_complete ()
2413
2415
js_utils .highlight_with_jquery (self .driver , selector , loops , o_bs )
2414
2416
2415
2417
def press_up_arrow (self , selector = "html" , times = 1 , by = By .CSS_SELECTOR ):
@@ -2538,7 +2540,7 @@ def slow_scroll_to(self, selector, by=By.CSS_SELECTOR, timeout=None):
2538
2540
self .__jquery_slow_scroll_to (selector , by )
2539
2541
else :
2540
2542
self .__slow_scroll_to_element (element )
2541
- except ( StaleElementReferenceException , ENI_Exception , JS_Exc ) :
2543
+ except Exception :
2542
2544
self .wait_for_ready_state_complete ()
2543
2545
time .sleep (0.12 )
2544
2546
element = self .wait_for_element_visible (
@@ -6525,7 +6527,7 @@ def __highlight_with_assert_success(
6525
6527
self .__jquery_slow_scroll_to (selector , by )
6526
6528
else :
6527
6529
self .__slow_scroll_to_element (element )
6528
- except ( StaleElementReferenceException , ENI_Exception ) :
6530
+ except Exception :
6529
6531
self .wait_for_ready_state_complete ()
6530
6532
time .sleep (0.12 )
6531
6533
element = self .wait_for_element_visible (
@@ -6540,7 +6542,7 @@ def __highlight_with_assert_success(
6540
6542
o_bs = '' # original_box_shadow
6541
6543
try :
6542
6544
style = element .get_attribute ('style' )
6543
- except ( StaleElementReferenceException , ENI_Exception ) :
6545
+ except Exception :
6544
6546
self .wait_for_ready_state_complete ()
6545
6547
time .sleep (0.12 )
6546
6548
element = self .wait_for_element_visible (
0 commit comments