def has_no_console_errors(selenium):
 logs = selenium.get_log('browser')
 severe_errors = [l for l in logs if (l.get('level') == 'SEVERE')]
 non_network_errors = [l for l in severe_errors if (l.get('type') != 'network')]
 if (len(non_network_errors) == 0):
  return True
 else:
  pytest.fail(('Console errors: %s' % non_network_errors))
 if ((len(non_network_errors) == 0) and (len(severe_errors) != 0)):
  warn(('There were severe network errors (this may or may not have affected your test): %s' % severe_errors))
 canvas = selenium.find_element_by_tag_name('canvas')
 wait_for_canvas_resize(canvas, selenium)

def has_no_console_errors ( selenium ) : logs = selenium . get_log ( 'browser' ) severe_errors = [ l for l in logs if ( l . get ( 'level' ) == 'SEVERE' ) ] non_network_errors = [ l for l in severe_errors if ( l . get ( 'type' ) != 'network' ) ] if ( len ( non_network_errors ) == 0 ) : return True else : pytest . fail ( ( 'Console errors: %s' % non_network_errors ) ) if ( ( len ( non_network_errors ) == 0 ) and ( len ( severe_errors ) != 0 ) ) : warn ( ( 'There were severe network errors (this may or may not have affected your test): %s' % severe_errors ) ) canvas = selenium . find_element_by_tag_name ( 'canvas' ) wait_for_canvas_resize ( canvas , selenium )
helper function to detect console errors .