OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 from selenium.webdriver.support.ui import WebDriverWait | 9 from selenium.webdriver.support.ui import WebDriverWait |
10 | 10 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 driver: The remote WebDriver instance to manage some content type. | 316 driver: The remote WebDriver instance to manage some content type. |
317 content_type: The content type to manage. | 317 content_type: The content type to manage. |
318 """ | 318 """ |
319 content_url = 'chrome://settings-frame/contentExceptions#%s' % content_type | 319 content_url = 'chrome://settings-frame/contentExceptions#%s' % content_type |
320 driver.get(content_url) | 320 driver.get(content_url) |
321 return ManageExceptionsPage(driver, content_type) | 321 return ManageExceptionsPage(driver, content_type) |
322 | 322 |
323 def __init__(self, driver, content_type): | 323 def __init__(self, driver, content_type): |
324 self._list_elem = driver.find_element_by_xpath( | 324 self._list_elem = driver.find_element_by_xpath( |
325 './/*[@id="content-settings-exceptions-area"]' | 325 './/*[@id="content-settings-exceptions-area"]' |
326 '//*[@contenttype="%s"]//list[@role="listbox"]' | 326 '//*[@contenttype="%s"]//list[@role="list"]' |
327 '[@class="settings-list"]' % content_type) | 327 '[@class="settings-list"]' % content_type) |
328 self._driver = driver | 328 self._driver = driver |
329 self._content_type = content_type | 329 self._content_type = content_type |
330 try: | 330 try: |
331 self._incognito_list_elem = driver.find_element_by_xpath( | 331 self._incognito_list_elem = driver.find_element_by_xpath( |
332 './/*[@id="content-settings-exceptions-area"]' | 332 './/*[@id="content-settings-exceptions-area"]' |
333 '//*[@contenttype="%s"]//div[not(@hidden)]' | 333 '//*[@contenttype="%s"]//div[not(@hidden)]' |
334 '//list[@mode="otr"][@role="listbox"]' | 334 '//list[@mode="otr"][@role="list"]' |
335 '[@class="settings-list"]' % content_type) | 335 '[@class="settings-list"]' % content_type) |
336 except selenium.common.exceptions.NoSuchElementException: | 336 except selenium.common.exceptions.NoSuchElementException: |
337 self._incognito_list_elem = None | 337 self._incognito_list_elem = None |
338 | 338 |
339 def _AssertIncognitoAvailable(self): | 339 def _AssertIncognitoAvailable(self): |
340 if not self._incognito_list_elem: | 340 if not self._incognito_list_elem: |
341 raise AssertionError( | 341 raise AssertionError( |
342 'Incognito settings in "%s" content page not available' | 342 'Incognito settings in "%s" content page not available' |
343 % self._content_type) | 343 % self._content_type) |
344 | 344 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 """ | 639 """ |
640 delete_button_list = self._list_elem.find_elements_by_class_name( | 640 delete_button_list = self._list_elem.find_elements_by_class_name( |
641 'row-delete-button') | 641 'row-delete-button') |
642 site_list = self.GetSiteNameList() | 642 site_list = self.GetSiteNameList() |
643 for i in range(len(site_list)): | 643 for i in range(len(site_list)): |
644 if site_list[i] == site: | 644 if site_list[i] == site: |
645 # Highlight the item so the close button shows up, then delete button | 645 # Highlight the item so the close button shows up, then delete button |
646 # shows up, then click on the delete button. | 646 # shows up, then click on the delete button. |
647 ActionChains(self._driver).move_to_element( | 647 ActionChains(self._driver).move_to_element( |
648 delete_button_list[i]).click().perform() | 648 delete_button_list[i]).click().perform() |
OLD | NEW |