• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2013 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import belkinF9K_ap_configurator
6import logging
7from selenium.common.exceptions import TimeoutException as \
8SeleniumTimeoutException
9
10
11class BelkinF7D1301APConfigurator(
12        belkinF9K_ap_configurator.BelkinF9KAPConfigurator):
13    """Class to configure Belkin F7D1301 v1 (01) router."""
14
15    def __init__(self, ap_config):
16        super(BelkinF7D1301APConfigurator, self).__init__(ap_config)
17        self._dhcp_delay = 0
18
19
20    def save_page(self, page_number):
21        """
22        Save changes and logout from the router.
23
24        @param page_number: the page number to save as an integer.
25
26        """
27        button = '//input[@type="submit" and @value="Apply Changes"]'
28        self.click_button_by_xpath(button,
29                                   alert_handler=self._security_alert)
30        self.set_wait_time(30)
31        try:
32            self.wait.until(lambda _:'index.htm' in self.driver.title)
33        except SeleniumTimeoutException, e:
34            xpath= '//h1[contains(text(), "Duplicate Administrator")]'
35            if (self.driver.find_element_by_xpath(xpath)):
36                logging.debug('We got a \'Duplicate Administrator\' page '
37                              'when we saved the changes.')
38            else:
39                raise RuntimeError("We couldn't save the page" + str(e))
40        finally:
41            self.restore_default_wait_time()
42