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

Side by Side Diff: chrome/test/chromedriver/run_py_tests.py

Issue 12764021: [chromedriver] Support clicking an element in sub frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error. Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/chromedriver/element_util.cc ('k') | chrome/test/chromedriver/session.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """End to end tests for ChromeDriver.""" 6 """End to end tests for ChromeDriver."""
7 7
8 import base64 8 import base64
9 import ctypes 9 import ctypes
10 import optparse 10 import optparse
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 'document.body.innerHTML = "<div>old</div>";' 262 'document.body.innerHTML = "<div>old</div>";'
263 'var div = document.getElementsByTagName("div")[0];' 263 'var div = document.getElementsByTagName("div")[0];'
264 'div.addEventListener("click", function() {' 264 'div.addEventListener("click", function() {'
265 ' var div = document.getElementsByTagName("div")[0];' 265 ' var div = document.getElementsByTagName("div")[0];'
266 ' div.innerHTML="new<br>";' 266 ' div.innerHTML="new<br>";'
267 '});' 267 '});'
268 'return div;') 268 'return div;')
269 div.Click() 269 div.Click()
270 self.assertEquals(1, len(self._driver.FindElements('tag name', 'br'))) 270 self.assertEquals(1, len(self._driver.FindElements('tag name', 'br')))
271 271
272 def testClickElementInSubFrame(self):
273 self._driver.Load(self.GetHttpUrlForFile('/chromedriver/frame_test.html'))
274 frame = self._driver.FindElement('tag name', 'iframe')
275 self._driver.SwitchToFrame(frame)
276 # Test clicking element in the sub frame.
277 self.testClickElement()
278
272 def testClearElement(self): 279 def testClearElement(self):
273 text = self._driver.ExecuteScript( 280 text = self._driver.ExecuteScript(
274 'document.body.innerHTML = \'<input type="text" value="abc">\';' 281 'document.body.innerHTML = \'<input type="text" value="abc">\';'
275 'var input = document.getElementsByTagName("input")[0];' 282 'var input = document.getElementsByTagName("input")[0];'
276 'input.addEventListener("change", function() {' 283 'input.addEventListener("change", function() {'
277 ' document.body.appendChild(document.createElement("br"));' 284 ' document.body.appendChild(document.createElement("br"));'
278 '});' 285 '});'
279 'return input;') 286 'return input;')
280 text.Clear() 287 text.Clear()
281 self.assertEquals(1, len(self._driver.FindElements('tag name', 'br'))) 288 self.assertEquals(1, len(self._driver.FindElements('tag name', 'br')))
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 global _ANDROID_PACKAGE 484 global _ANDROID_PACKAGE
478 _ANDROID_PACKAGE = options.android_package 485 _ANDROID_PACKAGE = options.android_package
479 486
480 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule( 487 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule(
481 sys.modules[__name__]) 488 sys.modules[__name__])
482 tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter) 489 tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter)
483 ChromeDriverTest.GlobalSetUp() 490 ChromeDriverTest.GlobalSetUp()
484 result = unittest.TextTestRunner(stream=sys.stdout).run(tests) 491 result = unittest.TextTestRunner(stream=sys.stdout).run(tests)
485 ChromeDriverTest.GlobalTearDown() 492 ChromeDriverTest.GlobalTearDown()
486 sys.exit(len(result.failures) + len(result.errors)) 493 sys.exit(len(result.failures) + len(result.errors))
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/element_util.cc ('k') | chrome/test/chromedriver/session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698