OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 import os |
| 7 import sys |
| 8 import unittest |
| 9 |
| 10 import pyauto_functional |
| 11 from pyauto import PyUITest |
| 12 |
| 13 |
| 14 class ExecuteJavascriptTest(PyUITest): |
| 15 |
| 16 def testExecuteJavascript(self): |
| 17 path = os.path.join(self.DataDir(), "frame_dom_access", |
| 18 "frame_dom_access.html") |
| 19 |
| 20 # FIXME: I'm not sure if this path will work on windows. |
| 21 self.NavigateToURL("file://%s" % path) |
| 22 |
| 23 v = self.ExecuteJavascript("window.domAutomationController.send(" + |
| 24 "document.getElementById('myinput').nodeName)") |
| 25 self.assertEqual(v, "INPUT") |
| 26 |
| 27 def testGetDOMValue(self): |
| 28 path = os.path.join(self.DataDir(), "frame_dom_access", |
| 29 "frame_dom_access.html") |
| 30 |
| 31 # FIXME: I'm not sure if this path will work on windows. |
| 32 self.NavigateToURL("file://%s" % path) |
| 33 |
| 34 v = self.GetDOMValue("document.getElementById('myinput').nodeName") |
| 35 self.assertEqual(v, "INPUT") |
| 36 |
| 37 |
| 38 if __name__ == '__main__': |
| 39 pyauto_functional.Main() |
OLD | NEW |