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

Unified 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: dsdsdsdjsdsj 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 side-by-side diff with in-line comments
Download patch
« chrome/test/webdriver/cookie.h ('K') | « chrome/test/webdriver/session.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/webdriver/webdriver_remote_tests.py
diff --git a/chrome/test/webdriver/webdriver_remote_tests.py b/chrome/test/webdriver/webdriver_remote_tests.py
index 1ff2b4461b7d035b49e34129fc302c06303605b1..9f876a4b9b6d3296cca5f34d9d44b5158ba82130 100644
--- a/chrome/test/webdriver/webdriver_remote_tests.py
+++ b/chrome/test/webdriver/webdriver_remote_tests.py
@@ -96,9 +96,10 @@ class RemoteWebDriverTest(unittest.TestCase):
search = string.lower(search)
self.assertNotEqual(-1, string.find(text, search))
+
class TestFindElement(RemoteWebDriverTest):
def testFindByName(self):
- navigate(SEARCH)
+ self.navigate(SEARCH)
# Find the Google search button.
q = self.driver.find_element_by_name("q")
self.assertTrue(isinstance(q, WebElement))
@@ -119,7 +120,7 @@ class TestFindElement(RemoteWebDriverTest):
self.assertTrue(isinstance(q, WebElement))
def testFindElementById(self):
- navigate(SEARCH)
+ self.navigate(SEARCH)
# Find the padding for the logo near the search bar.
elem = self.driver.find_element_by_id("logocont")
self.assertTrue(isinstance(elem, WebElement))
@@ -129,12 +130,62 @@ class TestFindElement(RemoteWebDriverTest):
def testFindElementById0WithTimeout(self):
self.set_implicit_wait(0)
- navigate(SEARCH)
+ self.navigate(SEARCH)
# Find the padding for the logo near the search bar.
elem = self.driver.find_element_by_id("logocont")
self.assertTrue(isinstance(elem, WebElement))
self.set_implicit_wait(5000)
- navigate(SEARCH)
+ self.navigate(SEARCH)
+ # Look for an ID not there.
+ self.assertRaises(NoSuchElementException,
+ self.driver.find_element_by_id, "logocont")
+
+
+class testCookies(RemoteWebDriverTest):
John Grabowski 2011/02/14 21:59:06 like all this
Joe 2011/02/15 02:30:48 FYI It''s still here I just moved it to a new sect
+ def testAddCookie(self):
+ self.navigate(SEARCH)
+ cookie_dict = {}
+ cookie_dict["name"]= "chromedriver_cookie_test";
+ cookie_dict["value"] = "this is a test";
+ self.driver.add_cookie(cookie_dict)
+ cookie_dict = None
+ cookie_dict = self.driver.get_cookie("chromedriver_cookie_test")
+ self.assertNotEqual(cookie_dict, None)
+ self.assertEqual(cookie_dict["value"], "this is a test";);
+
+ def testDeleteCookie(self):
+ testAddCookie();
+ self.driver.delete_cookie("chromedriver_cookie_test")
+ cookie_dict = self.driver.get_cookie("chromedriver_cookie_test")
+ self.assertEqual(cookie_dict, None)
+
+class TestFindElement(RemoteWebDriverTest):
+ def testFindByName(self):
+ self.navigate(SEARCH)
+ # Find the Google search button.
+ q = self.driver.find_element_by_name("q")
+ self.assertTrue(isinstance(q, WebElement))
+ # Trying looking for an element not on the page.
+ self.assertRaises(NoSuchElementException,
+ self.driver.find_elment_by_name, "q2")
+ # Try to find the Google search button using the multiple find method.
+ q = self.driver.find_elements_by_name("q")
+ self.assertTrue(isinstance(q, list))
+ self.assertTrue(len(q), 1)
+ self.assertTrue(isinstance(q[0], WebElement))
+ # Try finding something not on page, with multiple find an empty array
+ # should return and no exception thrown.
+ q = self.driver.find_elements_by_name("q2")
+ assertTrue(q == [])
+ # Find a hidden element on the page
+ q = self.driver.find_element_by_name("oq")
+ self.assertTrue(isinstance(q, WebElement))
+
+ def testFindElementById(self):
+ self.navigate(SEARCH)
+ # Find the padding for the logo near the search bar.
+ elem = self.driver.find_element_by_id("logocont")
+ self.assertTrue(isinstance(elem, WebElement))
# Look for an ID not there.
self.assertRaises(NoSuchElementException,
self.driver.find_element_by_id, "logocont")
« chrome/test/webdriver/cookie.h ('K') | « chrome/test/webdriver/session.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698