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

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: Renamed hook and updated doc strings. 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..eb16ce849111d7e93fe6c9a5981eb4156e204e70 100755
--- a/chrome/test/pyautolib/pyauto.py
+++ b/chrome/test/pyautolib/pyauto.py
@@ -3213,6 +3213,38 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
json_string = '[' + result + ']'
return json.loads(json_string)[0]
+ def ExecuteJavascriptInOOBEWebUI(self, js, frame_xpath=''):
+ """Executes a script in the specified frame of the OOBE WebUI.
+
+ By default, execute the script in the top frame of the OOBE window. This
+ also works for all OOBE pages, including the enterprise enrollment
+ screen and login page. 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': 'ExecuteJavascriptInOOBEWebUI',
+
+ '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