Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 try: | 6 try: |
| 7 import json | 7 import json |
| 8 except ImportError: # < 2.6 | 8 except ImportError: # < 2.6 |
| 9 import simplejson as json | 9 import simplejson as json |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 WEBDRIVER_PROCESS.kill() | 90 WEBDRIVER_PROCESS.kill() |
| 91 WEBDRIVER_PROCESS = None | 91 WEBDRIVER_PROCESS = None |
| 92 | 92 |
| 93 """Preforms a string search ignoring case""" | 93 """Preforms a string search ignoring case""" |
| 94 def assertFind(self, text, search): | 94 def assertFind(self, text, search): |
| 95 text = string.lower(text) | 95 text = string.lower(text) |
| 96 search = string.lower(search) | 96 search = string.lower(search) |
| 97 self.assertNotEqual(-1, string.find(text, search)) | 97 self.assertNotEqual(-1, string.find(text, search)) |
| 98 | 98 |
| 99 | 99 |
| 100 def Testcreenshots_dircreenShots(RemoteWebDriverTest): | |
|
kkania
2011/02/24 22:05:02
I think this test name got messed up. But why are
Joe
2011/03/02 02:21:25
Done.
| |
| 101 def testScreenCapture | |
| 102 self.navigate(SEARCH) | |
| 103 s1 = self.driver.get_screenshot_as_base64() | |
| 104 self.navigate(NEWS) | |
| 105 s2 = self.driver.get_screenshot_as_base64() | |
| 106 self.assertTrue(len(s1) > 0 && (len)s2 > 0) | |
| 107 self.assertTrue(len(s1) != len(s2)) | |
| 108 | |
| 109 | |
| 100 class TestFindElement(RemoteWebDriverTest): | 110 class TestFindElement(RemoteWebDriverTest): |
| 101 def testFindByName(self): | 111 def testFindByName(self): |
| 102 self.navigate(SEARCH) | 112 self.navigate(SEARCH) |
| 103 # Find the Google search button. | 113 # Find the Google search button. |
| 104 q = self.driver.find_element_by_name("q") | 114 q = self.driver.find_element_by_name("q") |
| 105 self.assertTrue(isinstance(q, WebElement)) | 115 self.assertTrue(isinstance(q, WebElement)) |
| 106 # Trying looking for an element not on the page. | 116 # Trying looking for an element not on the page. |
| 107 self.assertRaises(NoSuchElementException, | 117 self.assertRaises(NoSuchElementException, |
| 108 self.driver.find_elment_by_name, "q2") | 118 self.driver.find_elment_by_name, "q2") |
| 109 # Try to find the Google search button using the multiple find method. | 119 # Try to find the Google search button using the multiple find method. |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 if options.port: | 302 if options.port: |
| 293 WEBDRIVER_PORT = options.port | 303 WEBDRIVER_PORT = options.port |
| 294 if options.exe: | 304 if options.exe: |
| 295 WEBDRIVER_EXE = options.exe | 305 WEBDRIVER_EXE = options.exe |
| 296 if not os.path.exists(WEBDRIVER_EXE): | 306 if not os.path.exists(WEBDRIVER_EXE): |
| 297 parser.error('WebDriver server executable not found:\n\t%s\n' | 307 parser.error('WebDriver server executable not found:\n\t%s\n' |
| 298 'Please specify a valid path with the --exe flag.' | 308 'Please specify a valid path with the --exe flag.' |
| 299 % WEBDRIVER_EXE) | 309 % WEBDRIVER_EXE) |
| 300 | 310 |
| 301 unittest.main() | 311 unittest.main() |
| OLD | NEW |