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

Side by Side Diff: components/test/data/password_manager/automated_tests/environment.py

Issue 1147483003: [Password manager tests automation] Fix "No such frame" error. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 """The testing Environment class. 5 """The testing Environment class.
6 6
7 It holds the WebsiteTest instances, provides them with credentials, 7 It holds the WebsiteTest instances, provides them with credentials,
8 provides clean browser environment, runs the tests, and gathers the 8 provides clean browser environment, runs the tests, and gathers the
9 results. 9 results.
10 """ 10 """
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 websitetest.password = password_tag.text 106 websitetest.password = password_tag.text
107 self.websitetests.append(websitetest) 107 self.websitetests.append(websitetest)
108 108
109 def _ClearBrowserDataInit(self): 109 def _ClearBrowserDataInit(self):
110 """Opens and resets the chrome://settings/clearBrowserData dialog. 110 """Opens and resets the chrome://settings/clearBrowserData dialog.
111 111
112 It unchecks all checkboxes, and sets the time range to the "beginning of 112 It unchecks all checkboxes, and sets the time range to the "beginning of
113 time". 113 time".
114 """ 114 """
115 115
116 self.driver.get("chrome://settings/clearBrowserData") 116 self.driver.get("chrome://settings-frame/clearBrowserData")
117 self.driver.switch_to_frame("settings")
118 117
119 time_range_selector = "#clear-browser-data-time-period" 118 time_range_selector = "#clear-browser-data-time-period"
120 # TODO(vabr): Wait until time_range_selector is displayed instead. 119 # TODO(vabr): Wait until time_range_selector is displayed instead.
121 time.sleep(2) 120 time.sleep(2)
122 set_time_range = ( 121 set_time_range = (
123 "var range = document.querySelector('{0}');".format( 122 "var range = document.querySelector('{0}');".format(
124 time_range_selector) + 123 time_range_selector) +
125 "range.value = 4" # 4 == the beginning of time 124 "range.value = 4" # 4 == the beginning of time
126 ) 125 )
127 self.driver.execute_script(set_time_range) 126 self.driver.execute_script(set_time_range)
(...skipping 26 matching lines...) Expand all
154 "document.querySelector('#clear-browser-data-commit').click();" 153 "document.querySelector('#clear-browser-data-commit').click();"
155 ) 154 )
156 self.driver.execute_script(check_cookies_and_submit) 155 self.driver.execute_script(check_cookies_and_submit)
157 156
158 def _EnablePasswordSaving(self): 157 def _EnablePasswordSaving(self):
159 """Make sure that password manager is enabled.""" 158 """Make sure that password manager is enabled."""
160 159
161 # TODO(melandory): We should check why it's off in a first place. 160 # TODO(melandory): We should check why it's off in a first place.
162 # TODO(melandory): Investigate, maybe there is no need to enable it that 161 # TODO(melandory): Investigate, maybe there is no need to enable it that
163 # often. 162 # often.
164 self.driver.get("chrome://settings") 163 self.driver.get("chrome://settings-frame")
165 self.driver.switch_to_frame("settings")
166 script = "document.getElementById('advanced-settings-expander').click();" 164 script = "document.getElementById('advanced-settings-expander').click();"
167 self.driver.execute_script(script) 165 self.driver.execute_script(script)
168 # TODO(vabr): Wait until element is displayed instead. 166 # TODO(vabr): Wait until element is displayed instead.
169 time.sleep(2) 167 time.sleep(2)
170 script = ( 168 script = (
171 "if (!document.querySelector('#password-manager-enabled').checked) {" 169 "if (!document.querySelector('#password-manager-enabled').checked) {"
172 " document.querySelector('#password-manager-enabled').click();" 170 " document.querySelector('#password-manager-enabled').click();"
173 "}") 171 "}")
174 self.driver.execute_script(script) 172 self.driver.execute_script(script)
175 time.sleep(2) 173 time.sleep(2)
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 # for httplib.CannotSendRequest, so we can try to propagate information 292 # for httplib.CannotSendRequest, so we can try to propagate information
295 # that reason is an exception to the logging phase. 293 # that reason is an exception to the logging phase.
296 error = "Exception %s %s" % (type(e).__name__, e) 294 error = "Exception %s %s" % (type(e).__name__, e)
297 self.tests_results.append( 295 self.tests_results.append(
298 (websitetest.name, test_case_name, successful, error)) 296 (websitetest.name, test_case_name, successful, error))
299 297
300 def Quit(self): 298 def Quit(self):
301 """Shuts down the driver.""" 299 """Shuts down the driver."""
302 300
303 self.driver.quit() 301 self.driver.quit()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698