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

Side by Side Diff: chrome/test/webdriver/webdriver_remote_tests.py

Issue 6330012: Cookie commands for the webdriver protocol (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 10 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 #!/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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 # Find the padding for the logo near the search bar. 133 # Find the padding for the logo near the search bar.
134 elem = self.driver.find_element_by_id("logocont") 134 elem = self.driver.find_element_by_id("logocont")
135 self.assertTrue(isinstance(elem, WebElement)) 135 self.assertTrue(isinstance(elem, WebElement))
136 self.set_implicit_wait(5000) 136 self.set_implicit_wait(5000)
137 navigate(SEARCH) 137 navigate(SEARCH)
138 # Look for an ID not there. 138 # Look for an ID not there.
139 self.assertRaises(NoSuchElementException, 139 self.assertRaises(NoSuchElementException,
140 self.driver.find_element_by_id, "logocont") 140 self.driver.find_element_by_id, "logocont")
141 141
142 142
143 class testCookies(RemoteWebDriverTest):
144 def testAddCookie(self):
145 navigate(SEARCH)
kkania 2011/01/28 23:25:59 this file seems to be broken; it doesn't run for m
Joe 2011/02/03 10:02:05 I added self. and this file runs for me, what erro
146 cookie_dict = {}
147 cookie_dict["name"]= "chromedriver_cookie_test";
148 cookie_dict["value"] = "this is a test";
149 self.driver.add_cookie(cookie_dict)
150 cookie_dict = None
151 cookie_dict = self.driver.get_cookie("chromedriver_cookie_test")
152 self.assertNotEqual(cookie_dict, None)
153 self.assertEqual(cookie_dict["value"], "this is a test";);
154
155 def testDeleteCookie(self):
156 testAddCookie();
157 self.driver.delete_cookie("chromedriver_cookie_test")
158 cookie_dict = self.driver.get_cookie("chromedriver_cookie_test")
159 self.assertEqual(cookie_dict, None)
160
161 class TestFindElement(RemoteWebDriverTest):
162 def testFindByName(self):
163 navigate(SEARCH)
164 # Find the Google search button.
165 q = self.driver.find_element_by_name("q")
166 self.assertTrue(isinstance(q, WebElement))
167 # Trying looking for an element not on the page.
168 self.assertRaises(NoSuchElementException,
169 self.driver.find_elment_by_name, "q2")
170 # Try to find the Google search button using the multiple find method.
171 q = self.driver.find_elements_by_name("q")
172 self.assertTrue(isinstance(q, list))
173 self.assertTrue(len(q), 1)
174 self.assertTrue(isinstance(q[0], WebElement))
175 # Try finding something not on page, with multiple find an empty array
176 # should return and no exception thrown.
177 q = self.driver.find_elements_by_name("q2")
178 assertTrue(q == [])
179 # Find a hidden element on the page
180 q = self.driver.find_element_by_name("oq")
181 self.assertTrue(isinstance(q, WebElement))
182
183 def testFindElementById(self):
184 navigate(SEARCH)
185 # Find the padding for the logo near the search bar.
186 elem = self.driver.find_element_by_id("logocont")
187 self.assertTrue(isinstance(elem, WebElement))
188 # Look for an ID not there.
189 self.assertRaises(NoSuchElementException,
190 self.driver.find_element_by_id, "logocont")
191
192
143 class TestJavaScriptExecution(RemoteWebDriverTest): 193 class TestJavaScriptExecution(RemoteWebDriverTest):
144 """ Test the execute javascript ability of the remote driver""" 194 """ Test the execute javascript ability of the remote driver"""
145 def testNoModification(self): 195 def testNoModification(self):
146 self.driver.get("http://www.google.com") 196 self.driver.get("http://www.google.com")
147 title = self.driver.execute_script("return document.title") 197 title = self.driver.execute_script("return document.title")
148 self.assertEqual(title, self.driver.get_title()) 198 self.assertEqual(title, self.driver.get_title())
149 199
150 def testModification(self): 200 def testModification(self):
151 self.driver.get("http://www.google.com") 201 self.driver.get("http://www.google.com")
152 title = self.driver.get_title() 202 title = self.driver.get_title()
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 if options.port: 309 if options.port:
260 WEBDRIVER_PORT = options.port 310 WEBDRIVER_PORT = options.port
261 if options.exe: 311 if options.exe:
262 WEBDRIVER_EXE = options.exe 312 WEBDRIVER_EXE = options.exe
263 if not os.path.exists(WEBDRIVER_EXE): 313 if not os.path.exists(WEBDRIVER_EXE):
264 parser.error('WebDriver server executable not found:\n\t%s\n' 314 parser.error('WebDriver server executable not found:\n\t%s\n'
265 'Please specify a valid path with the --exe flag.' 315 'Please specify a valid path with the --exe flag.'
266 % WEBDRIVER_EXE) 316 % WEBDRIVER_EXE)
267 317
268 unittest.main() 318 unittest.main()
OLDNEW
« chrome/test/webdriver/cookie.cc ('K') | « chrome/test/webdriver/server.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698