@@ -5005,18 +5005,33 @@ def assert_no_js_errors(self):
5005
5005
except (ValueError , WebDriverException ):
5006
5006
# If unable to get browser logs, skip the assert and return.
5007
5007
return
5008
-
5009
5008
messenger_library = "//cdnjs.cloudflare.com/ajax/libs/messenger"
5009
+ underscore_library = "//cdnjs.cloudflare.com/ajax/libs/underscore"
5010
5010
errors = []
5011
5011
for entry in browser_logs :
5012
5012
if entry ["level" ] == "SEVERE" :
5013
- if messenger_library not in entry ["message" ]:
5013
+ if (
5014
+ messenger_library not in entry ["message" ]
5015
+ and underscore_library not in entry ["message" ]
5016
+ ):
5014
5017
# Add errors if not caused by SeleniumBase dependencies
5015
5018
errors .append (entry )
5016
5019
if len (errors ) > 0 :
5020
+ for n in range (len (errors )):
5021
+ f_t_l_r = " - Failed to load resource"
5022
+ u_c_t_e = " Uncaught TypeError: "
5023
+ if f_t_l_r in errors [n ]["message" ]:
5024
+ url = errors [n ]["message" ].split (f_t_l_r )[0 ]
5025
+ errors [n ] = {"Error 404 (broken link)" : url }
5026
+ elif u_c_t_e in errors [n ]["message" ]:
5027
+ url = errors [n ]["message" ].split (u_c_t_e )[0 ]
5028
+ error = errors [n ]["message" ].split (u_c_t_e )[1 ]
5029
+ errors [n ] = {"Uncaught TypeError (%s)" % error : url }
5030
+ er_str = str (errors )
5031
+ er_str = er_str .replace ("[{" , "[\n {" ).replace ("}, {" , "},\n {" )
5017
5032
current_url = self .get_current_url ()
5018
5033
raise Exception (
5019
- "JavaScript errors found on %s => %s" % (current_url , errors )
5034
+ "JavaScript errors found on %s => %s" % (current_url , er_str )
5020
5035
)
5021
5036
if self .demo_mode :
5022
5037
if self .browser == "chrome" or self .browser == "edge" :
0 commit comments