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

Unified Diff: chrome/test/pyautolib/pyauto.py

Issue 10257015: Added a new automation hook ExecuteJavascriptInOOBEWebUI() to execute javascript prior to login on… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed reviewer comments. Created 8 years, 8 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 | « chrome/test/functional/chromeos_login.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/pyautolib/pyauto.py
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py
index 683b8a4c75effebee230a7bde1a33ceafed2d139..78a10a94d56cee1cbe7cac73e6dbdfa2957c9c8f 100755
--- a/chrome/test/pyautolib/pyauto.py
+++ b/chrome/test/pyautolib/pyauto.py
@@ -3213,6 +3213,36 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
json_string = '[' + result + ']'
return json.loads(json_string)[0]
+ def ExecuteJavascriptInLoginWebUI(self, js, frame_xpath=''):
Nirnimesh 2012/04/30 18:57:07 Login -> OOBE
+ """Executes a script in the specified frame of a pre-login WebUI.
Nirnimesh 2012/04/30 18:57:07 pre-login -> OOBE
+
+ By default, execute the script in the top frame of the login window. This
Nirnimesh 2012/04/30 18:57:07 Remove reference to 'login'. Mention: Can be used
+ also works for other pre-login pages, including the enterprise enrollment
+ screen. The invoked javascript function must send a result back via the
+ domAutomationController.send function, or this function will never return.
+
+ Args:
+ js: Script to be executed.
+ frame_xpath: XPath of the frame to execute the script. Default is no
+ frame. Example: '//frames[1]'
+
+ Returns:
+ A value that was sent back via the domAutomationController.send method.
+
+ Raises:
+ pyauto_errors.JSONInterfaceError if the automation call returns an error.
+ """
+ cmd_dict = {
+ 'command': 'ExecuteJavascriptInLoginWebUI',
+ 'javascript': js,
+ 'frame_xpath': frame_xpath,
+ }
+ result = self._GetResultFromJSONRequest(cmd_dict, windex=None)['result']
+ # Wrap result in an array before deserializing because valid JSON has an
+ # array or an object as the root.
+ return json.loads('[' + result + ']')[0]
+
+
def GetDOMValue(self, expr, tab_index=0, windex=0, frame_xpath=''):
"""Executes a Javascript expression and returns the value.
« no previous file with comments | « chrome/test/functional/chromeos_login.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698