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

Unified Diff: telemetry/telemetry/internal/backends/form_based_credentials_backend.py

Issue 2615943003: [Telemetry] Allow value interpolation in action_runner JavaScript API (Closed)
Patch Set: fix more tests Created 3 years, 11 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
Index: telemetry/telemetry/internal/backends/form_based_credentials_backend.py
diff --git a/telemetry/telemetry/internal/backends/form_based_credentials_backend.py b/telemetry/telemetry/internal/backends/form_based_credentials_backend.py
index 3014c3816973f5ec6eed7f7d040868c7ec671c25..aaa56b40aa43224569d0b8d919e8bfeaaa54b82b 100644
--- a/telemetry/telemetry/internal/backends/form_based_credentials_backend.py
+++ b/telemetry/telemetry/internal/backends/form_based_credentials_backend.py
@@ -56,10 +56,10 @@ class FormBasedCredentialsBackend(object):
def _WaitForLoginState(self, action_runner):
"""Waits until it can detect either the login form, or already logged in."""
- # TODO(catapult:#3028): Fix interpolation of JavaScript values.
- condition = '(document.querySelector("#%s") !== null) || (%s)' % (
- self.login_form_id, self.logged_in_javascript)
- action_runner.WaitForJavaScriptCondition(condition, 60)
+ action_runner.WaitForJavaScriptCondition(
+ '(document.querySelector({{ form_id }}) !== null) || ({{ @code }})',
+ form_id=self.login_form_id, code=self.logged_in_javascript,
+ timeout_in_seconds=60)
def _SubmitLoginFormAndWait(self, action_runner, tab, username, password):
"""Submits the login form and waits for the navigation."""

Powered by Google App Engine
This is Rietveld 408576698