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

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

Issue 11746025: [chromedriver]Implement command: title. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """End to end tests for ChromeDriver.""" 5 """End to end tests for ChromeDriver."""
6 6
7 import ctypes 7 import ctypes
8 import os 8 import os
9 import sys 9 import sys
10 import unittest 10 import unittest
(...skipping 27 matching lines...) Expand all
38 script = 'return arguments[0].innerHTML + arguments[1].innerHTML'; 38 script = 'return arguments[0].innerHTML + arguments[1].innerHTML';
39 self.assertEquals('bc', driver.ExecuteScript(script, stuff[0], stuff[1])) 39 self.assertEquals('bc', driver.ExecuteScript(script, stuff[0], stuff[1]))
40 driver.Quit() 40 driver.Quit()
41 41
42 def testEvaluateInvalidScript(self): 42 def testEvaluateInvalidScript(self):
43 driver = chromedriver.ChromeDriver(_CHROMEDRIVER_LIB, _CHROME_BINARY) 43 driver = chromedriver.ChromeDriver(_CHROMEDRIVER_LIB, _CHROME_BINARY)
44 self.assertRaises(chromedriver.ChromeDriverException, 44 self.assertRaises(chromedriver.ChromeDriverException,
45 driver.ExecuteScript, '{{{') 45 driver.ExecuteScript, '{{{')
46 driver.Quit() 46 driver.Quit()
47 47
48 def testGetTitle(self):
49 driver = chromedriver.ChromeDriver(_CHROMEDRIVER_LIB, _CHROME_BINARY)
50 driver.Load('http://www.google.com/webhp?hl=en')
kkania 2013/01/04 04:35:34 don't use real pages in tests; use a test page
chrisgao (Use stgao instead) 2013/01/05 01:19:09 Done.
51 import time
kkania 2013/01/04 04:35:34 don't sleep in tests; that leads to slower tests o
chrisgao (Use stgao instead) 2013/01/05 01:19:09 Done.
52 time.sleep(5)
53 self.assertEqual('Google', driver.GetTitle())
54 driver.Quit()
55
48 56
49 if __name__ == '__main__': 57 if __name__ == '__main__':
50 if len(sys.argv) != 2 and len(sys.argv) != 3: 58 if len(sys.argv) != 2 and len(sys.argv) != 3:
51 print ('Usage: %s <path_to_chromedriver_so> [path_to_chrome_binary]' % 59 print ('Usage: %s <path_to_chromedriver_so> [path_to_chrome_binary]' %
52 __file__) 60 __file__)
53 sys.exit(1) 61 sys.exit(1)
54 global _CHROMEDRIVER_LIB 62 global _CHROMEDRIVER_LIB
55 _CHROMEDRIVER_LIB = os.path.abspath(sys.argv[1]) 63 _CHROMEDRIVER_LIB = os.path.abspath(sys.argv[1])
56 global _CHROME_BINARY 64 global _CHROME_BINARY
57 if len(sys.argv) == 3: 65 if len(sys.argv) == 3:
58 _CHROME_BINARY = os.path.abspath(sys.argv[2]) 66 _CHROME_BINARY = os.path.abspath(sys.argv[2])
59 else: 67 else:
60 _CHROME_BINARY = None 68 _CHROME_BINARY = None
61 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule( 69 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule(
62 sys.modules[__name__]) 70 sys.modules[__name__])
63 result = unittest.TextTestRunner().run(all_tests_suite) 71 result = unittest.TextTestRunner().run(all_tests_suite)
64 sys.exit(len(result.failures) + len(result.errors)) 72 sys.exit(len(result.failures) + len(result.errors))
OLDNEW
« chrome/test/chromedriver/commands.cc ('K') | « chrome/test/chromedriver/commands.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698