Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1003)

Unified Diff: telemetry/telemetry/internal/browser/web_contents.py

Issue 1765283002: [Telemetry] Print out console output instead of page state on TimeoutException (Closed) Base URL: https://github.com/catapult-project/catapult@master
Patch Set: Remove dump_page_state_on_timeout Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « telemetry/telemetry/internal/browser/tab_unittest.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/telemetry/internal/browser/web_contents.py
diff --git a/telemetry/telemetry/internal/browser/web_contents.py b/telemetry/telemetry/internal/browser/web_contents.py
index 58d83e8a3aad726bd4d96a4741e5e3cc85e6b5e1..946f1964f9d31316f3040e502c0d2b0bbc1225c0 100644
--- a/telemetry/telemetry/internal/browser/web_contents.py
+++ b/telemetry/telemetry/internal/browser/web_contents.py
@@ -72,8 +72,7 @@ class WebContents(object):
'document.readyState == "interactive" || '
'document.readyState == "complete"', timeout)
- def WaitForJavaScriptExpression(self, expr, timeout,
- dump_page_state_on_timeout=True):
+ def WaitForJavaScriptExpression(self, expr, timeout):
"""Waits for the given JavaScript expression to be True.
This method is robust against any given Evaluation timing out.
@@ -81,8 +80,6 @@ class WebContents(object):
Args:
expr: The expression to evaluate.
timeout: The number of seconds to wait for the expression to be True.
- dump_page_state_on_timeout: Whether to provide additional information on
- the page state if a TimeoutException is thrown.
Raises:
exceptions.TimeoutException: On a timeout.
@@ -100,33 +97,10 @@ class WebContents(object):
try:
util.WaitFor(IsJavaScriptExpressionTrue, timeout)
except exceptions.TimeoutException as e:
- if not dump_page_state_on_timeout:
- raise
-
- # Try to make timeouts a little more actionable by dumping |this|.
- raise exceptions.TimeoutException(e.message + self.EvaluateJavaScript("""
- (function() {
- var error = '\\n\\nJavaScript |this|:\\n';
- for (name in this) {
- try {
- error += '\\t' + name + ': ' + this[name] + '\\n';
- } catch (e) {
- error += '\\t' + name + ': ???\\n';
- }
- }
- if (window && window.document) {
- error += '\\n\\nJavaScript window.document:\\n';
- for (name in window.document) {
- try {
- error += '\\t' + name + ': ' + window.document[name] + '\\n';
- } catch (e) {
- error += '\\t' + name + ': ???\\n';
- }
- }
- }
- return error;
- })();
- """))
+ # Try to make timeouts a little more actionable by dumping console output.
+ raise exceptions.TimeoutException(
+ e.message + '\nConsole output:\n' +
+ self._inspector_backend.GetCurrentConsoleOutputBuffer())
def HasReachedQuiescence(self):
"""Determine whether the page has reached quiescence after loading.
« no previous file with comments | « telemetry/telemetry/internal/browser/tab_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698