OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 import types | 5 import types |
6 | 6 |
7 import selenium.common.exceptions | 7 import selenium.common.exceptions |
8 from selenium.webdriver.common.action_chains import ActionChains | 8 from selenium.webdriver.common.action_chains import ActionChains |
9 | 9 |
10 | 10 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 self.elem.send_keys(value) | 180 self.elem.send_keys(value) |
181 | 181 |
182 def Get(self): | 182 def Get(self): |
183 """Returns the value of the text field.""" | 183 """Returns the value of the text field.""" |
184 return self.elem.get_attribute('value') | 184 return self.elem.get_attribute('value') |
185 | 185 |
186 | 186 |
187 class AutofillEditAddressDialog(object): | 187 class AutofillEditAddressDialog(object): |
188 """The overlay for editing an autofill address.""" | 188 """The overlay for editing an autofill address.""" |
189 | 189 |
190 _URL = 'chrome://settings/autofillEditAddress' | 190 _URL = 'chrome://settings-frame/autofillEditAddress' |
191 | 191 |
192 @staticmethod | 192 @staticmethod |
193 def FromNavigation(driver): | 193 def FromNavigation(driver): |
194 """Creates an instance of the dialog by navigating directly to it.""" | 194 """Creates an instance of the dialog by navigating directly to it.""" |
195 driver.get(AutofillEditAddressDialog._URL) | 195 driver.get(AutofillEditAddressDialog._URL) |
196 return AutofillEditAddressDialog(driver) | 196 return AutofillEditAddressDialog(driver) |
197 | 197 |
198 def __init__(self, driver): | 198 def __init__(self, driver): |
199 self.driver = driver | 199 self.driver = driver |
200 assert self._URL == driver.current_url | 200 assert self._URL == driver.current_url |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 class Behaviors(object): | 273 class Behaviors(object): |
274 ALLOW = 'allow' | 274 ALLOW = 'allow' |
275 SESSION_ONLY = 'session_only' | 275 SESSION_ONLY = 'session_only' |
276 ASK = 'ask' | 276 ASK = 'ask' |
277 BLOCK = 'block' | 277 BLOCK = 'block' |
278 | 278 |
279 | 279 |
280 class ContentSettingsPage(object): | 280 class ContentSettingsPage(object): |
281 """The overlay for managing exceptions on the Content Settings page.""" | 281 """The overlay for managing exceptions on the Content Settings page.""" |
282 | 282 |
283 _URL = 'chrome://settings/content' | 283 _URL = 'chrome://settings-frame/content' |
284 | 284 |
285 @staticmethod | 285 @staticmethod |
286 def FromNavigation(driver): | 286 def FromNavigation(driver): |
287 """Creates an instance of the dialog by navigating directly to it.""" | 287 """Creates an instance of the dialog by navigating directly to it.""" |
288 driver.get(ContentSettingsPage._URL) | 288 driver.get(ContentSettingsPage._URL) |
289 return ContentSettingsPage(driver) | 289 return ContentSettingsPage(driver) |
290 | 290 |
291 def __init__(self, driver): | 291 def __init__(self, driver): |
292 assert self._URL == driver.current_url | 292 assert self._URL == driver.current_url |
293 self.page_elem = driver.find_element_by_id( | 293 self.page_elem = driver.find_element_by_id( |
(...skipping 14 matching lines...) Expand all Loading... |
308 """The overlay for the content exceptions page.""" | 308 """The overlay for the content exceptions page.""" |
309 | 309 |
310 @staticmethod | 310 @staticmethod |
311 def FromNavigation(driver, content_type): | 311 def FromNavigation(driver, content_type): |
312 """Creates an instance of the dialog by navigating directly to it. | 312 """Creates an instance of the dialog by navigating directly to it. |
313 | 313 |
314 Args: | 314 Args: |
315 driver: The remote WebDriver instance to manage some content type. | 315 driver: The remote WebDriver instance to manage some content type. |
316 content_type: The content type to manage. | 316 content_type: The content type to manage. |
317 """ | 317 """ |
318 content_url = 'chrome://settings/contentExceptions#%s' % content_type | 318 content_url = 'chrome://settings-frame/contentExceptions#%s' % content_type |
319 driver.get(content_url) | 319 driver.get(content_url) |
320 return ManageExceptionsPage(driver, content_type) | 320 return ManageExceptionsPage(driver, content_type) |
321 | 321 |
322 def __init__(self, driver, content_type): | 322 def __init__(self, driver, content_type): |
323 content_url = 'chrome://settings/contentExceptions#%s' % content_type | |
324 assert content_url == driver.current_url | |
325 self._list_elem = driver.find_element_by_xpath( | 323 self._list_elem = driver.find_element_by_xpath( |
326 './/*[@id="content-settings-exceptions-area"]' | 324 './/*[@id="content-settings-exceptions-area"]' |
327 '//*[@contenttype="%s"]//list[@role="listbox"]' | 325 '//*[@contenttype="%s"]//list[@role="listbox"]' |
328 '[@class="settings-list"]' % content_type) | 326 '[@class="settings-list"]' % content_type) |
329 self._driver = driver | 327 self._driver = driver |
330 self._content_type = content_type | 328 self._content_type = content_type |
331 try: | 329 try: |
332 self._incognito_list_elem = driver.find_element_by_xpath( | 330 self._incognito_list_elem = driver.find_element_by_xpath( |
333 './/*[@id="content-settings-exceptions-area"]' | 331 './/*[@id="content-settings-exceptions-area"]' |
334 '//*[@contenttype="%s"]//div[not(@hidden)]' | 332 '//*[@contenttype="%s"]//div[not(@hidden)]' |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 listitem_elem.find_element_by_xpath( | 461 listitem_elem.find_element_by_xpath( |
464 './/option[@value="%s"]' % behavior).click() | 462 './/option[@value="%s"]' % behavior).click() |
465 except selenium.common.exceptions.ElementNotVisibleException: | 463 except selenium.common.exceptions.ElementNotVisibleException: |
466 raise AssertionError( | 464 raise AssertionError( |
467 'Changing the behavior is invalid for pattern ' | 465 'Changing the behavior is invalid for pattern ' |
468 '"%s" in "%s" content page' % (behavior, self._content_type)) | 466 '"%s" in "%s" content page' % (behavior, self._content_type)) |
469 # Send enter key. | 467 # Send enter key. |
470 pattern_elem = listitem_elem.find_element_by_tag_name('input') | 468 pattern_elem = listitem_elem.find_element_by_tag_name('input') |
471 _FocusField(self._driver, list_elem, pattern_elem) | 469 _FocusField(self._driver, list_elem, pattern_elem) |
472 pattern_elem.send_keys('\n') | 470 pattern_elem.send_keys('\n') |
OLD | NEW |