1# Copyright (c) 2014 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
5from selenium.common.exceptions import WebDriverException
6
7import linksyse1500_ap_configurator
8
9
10class LinksysM10APConfigurator(
11        linksyse1500_ap_configurator.Linksyse1500APConfigurator):
12    """Base class for objects to configure Linksys m10 and m20."""
13
14
15    def save_page(self, page_number):
16        """Saves the page.
17
18        @param page_number: the page number as an integer
19
20        """
21        submit_btn = '//a[@href="javascript:to_submit(document.forms[0])"]'
22        continue_btn = '//input[@value="Continue" and @onclick="to_submit()"]'
23        try:
24            self.click_button_by_xpath(submit_btn,
25                                       alert_handler=self._sec_alert)
26            self.wait_for_object_by_xpath(continue_btn, wait_time=10)
27            self.click_button_by_xpath(continue_btn,
28                                       alert_handler=self._sec_alert)
29        except WebDriverException, e:
30            self._check_for_alert_in_message(str(e),
31                                             alert_handler=self._sec_alert)
32