Clear out console logs before opening or refreshing pages
This commit is contained in:
parent
3da18b02fb
commit
0064e85643
|
@ -98,6 +98,7 @@ class BaseCase(unittest.TestCase):
|
|||
def open(self, url):
|
||||
""" Navigates the current browser window to the specified page. """
|
||||
self.__last_page_load_url = None
|
||||
js_utils.clear_out_console_logs(self.driver)
|
||||
if url.startswith("://"):
|
||||
# Convert URLs such as "://google.com" into "https://google.com"
|
||||
url = "https" + url
|
||||
|
@ -424,6 +425,7 @@ class BaseCase(unittest.TestCase):
|
|||
|
||||
def refresh_page(self):
|
||||
self.__last_page_load_url = None
|
||||
js_utils.clear_out_console_logs(self.driver)
|
||||
self.driver.refresh()
|
||||
self.wait_for_ready_state_complete()
|
||||
|
||||
|
|
|
@ -790,6 +790,15 @@ def get_drag_and_drop_script():
|
|||
return script
|
||||
|
||||
|
||||
def clear_out_console_logs(driver):
|
||||
try:
|
||||
# Clear out the current page log before navigating to a new page
|
||||
# (To make sure that assert_no_js_errors() uses current results)
|
||||
driver.get_log('browser')
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
@decorators.deprecated("Use re.escape() instead, which does what you want!")
|
||||
def _jq_format(code):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue