def go_to_rice(self) -> Rice: """Click the Rice University link. :return: the Rice University home page :rtype: :py:class:`~pages.rice.home.Rice` """ link = self.find_element(*self._rice_link_locator) url = link.get_attribute('href') Utility.switch_to(self.driver, element=link) return go_to_external_(Rice(self.driver), url)
def submit_this_answer(self) -> Practice: """Submit the invalid free response. :return: the multiple choice answer step for the assessment :rtype: :py:class:`~pages.tutor.practice.Practice` """ link = self.find_element(*self._submit_this_answer_locator) Utility.click_option(self.driver, element=link) sleep(1) return self
def select(self): """Click on the timezone radio button. :return: the timezone modal :rtype: :py:class:`ChangeCourseTimezone` """ button = self.find_element(*self._button_locator) Utility.click_option(self.driver, element=button) sleep(0.25) # to allow the preview time to update return self.page
def performance_forecast(self): """Click on the 'Performance Forecast' button. :return: the course performance overview page :rtype: :py:class:`~pages.tutor.performance.Performance` """ button = self.find_element(*self._performance_forecast_locator) Utility.click_option(self.driver, element=button) from pages.tutor.performance import PerformanceForecast return go_to_(PerformanceForecast(self.driver, self.page.base_url))
def next_month(self): """Click on the right arrow to view the next month. :return: the next month's calendar view :rtype: :py:class:`Calendar` """ button = self.find_element(*self._next_month_locator) Utility.click_option(self.driver, element=button) sleep(0.5) return Calendar(self.driver, self.page.base_url)
def view_reference(self) -> ReferenceBook: """Click on the associated book section name. :return: the reference book showing the requested chapter section :rtype: :py:class:`~pages.tutor.reference.RefernceBook` """ link = self.find_element(*self._view_book_section_link_locator) Utility.switch_to(self.driver, element=link) sleep(1) return go_to_(ReferenceBook(self.driver, base_url=self.page.base_url))
def browse_the_book(self): """Click on the 'Browse the Book' button. :return: the reference book view in a new tab :rtype: :py:class:`~pages.tutor.reference.ReferenceBook` """ button = self.find_element(*self._browse_the_book_locator) Utility.switch_to(self.driver, element=button) from pages.tutor.reference import ReferenceBook return go_to_(ReferenceBook(self.driver, self.page.base_url))
def go_to_log_in(self): """Click the 'LOG IN' button. :return: the Accounts log in page :rtype: :py:class:`~pages.accounts.home.AccountsHome` """ button = self.find_element(*self._log_in_locator) Utility.click_option(self.driver, element=button) from pages.accounts.home import AccountsHome return go_to_(AccountsHome(self.driver))
def ok(self) -> Page: """Click the 'OK' button. :return: the current page :rtype: :py:class:`~pypom.Page` """ button = self.find_element(*self._ok_button_locator) Utility.click_option(self.driver, element=button) sleep(0.5) return Utility.parent_page(self)
def try_free(self) -> FreeTrial: """Click the 'Try free' button. :return: the free trial modal :rtype: :py:class:`~pages.tutor.enrollment.FreeTrial` """ button = self.find_element(*self._try_free_button_locator) Utility.click_option(self.driver, element=button) sleep(1) return FreeTrial(self.page)
def view_later(self) -> Page: """Click on the 'View later' button. :return: the tooltip's parent page :rtype: :py:class:`~pypom.Page` """ button = self.find_element(*self._view_later_button_locator) Utility.click_option(self.driver, element=button) sleep(0.25) return self.page
def buy_access_now(self) -> PurchaseForm: """Click the 'Buy access now' button. :return: the purchase form modal :rtype: :py:class:`~pages.tutor.enrollment.PurchaseForm` """ button = self.find_element(*self._buy_access_now_button_locator) Utility.click_option(self.driver, element=button) sleep(1) return PurchaseForm(self.page)
def impersonate(self): """Log in as the user.""" impersonate = self.find_element(*self._impersonate_locator) Utility.click_option(self.driver, element=impersonate) self.driver.switch_to_alert().accept() sleep(1.0) from pages.accounts.profile import Profile profile = Profile(self.driver, self.page.base_url) profile.open() sleep(10) return profile
def view_terms(self): """View the general Tutor terms of service and privacy policy. :return: the OpenStax Tutor Beta terms and policy page :rtype: :py:class:`~pages.tutor.legal.Terms` """ link = self.find_element(*self._terms_link_locator) Utility.click_option(self.driver, element=link) from pages.tutor.legal import Terms return go_to_(Terms(self.driver, base_url=self.page.base_url))
def view_section(self): """Click the section link. :return: the reference book with the selected section in the content region :rtype: :py:class:`ReferenceBook` """ link = self.find_element(*self._link_locator) Utility.click_option(self.driver, element=link) return self.page.page.page
def delete(self) -> Provider.Popup: """Remove the log in method from the account. :return: the confirmation pop up box :rtype: :py:class:`~pages.accounts.profile.Popup` """ button = self.find_element(*self._delete_button_locator) Utility.click_option(self.driver, element=button) sleep(0.1) return Popup(self)
def suggest_a_correction(self) -> ErrataForm: """Click on the 'Suggest a correction' link. :return: the OpenStax.org errata form :rtype: :py:class:`~pages.web.errata.ErrataForm` """ link = self.find_element(*self._suggest_a_correction_link_locator) Utility.switch_to(self.driver, element=link) sleep(1) return go_to_(ErrataForm(self.driver))
def edit(self) -> ChangePassword: """Edit the password log in method. :return: the change password form :rtype: :py:class:`~pages.accounts.reset.ChangePassword` """ base_url = Utility.parent_page(self).base_url button = self.find_element(*self._edit_button_locator) Utility.click_option(self.driver, element=button) return go_to_(ChangePassword(self.driver, base_url=base_url))
def add_assignment(self): """Click on the 'Add Assignment' toggle button. :return: the course calendar :rtype: :py:class:`Calendar` """ button = self.find_element(*self._assignment_toggle_locator) Utility.click_option(self.driver, element=button) sleep(0.5) return self.page
def accept(self) -> Profile: """Click the accept checkmark button. :return: the user profile :rtype: :py:class:`~pages.accounts.profile.Profile` """ button = self.find_element(*self._accept_button_locator) Utility.click_option(self.driver, element=button) sleep(1.0) return Utility.parent_page(self)
def question_library(self): """Click on the 'Question Library' button. :return: the course question library page :rtype: :py:class:`~pages.tutor.library.QuestionLibrary` """ button = self.find_element(*self._question_library_locator) Utility.click_option(self.driver, element=button) from pages.tutor.question_library import QuestionLibrary return go_to_(QuestionLibrary(self.driver, self.page.base_url))
def add_email_address(self) -> Profile.Content.Emails.Email: r"""Click the 'Add email address' link. :return: the new account email entry form :rtype: :py:class:`~pages.accounts.profile. \ Profile.Content.Emails.Email` """ link = self.find_element(*self._add_email_address_link_locator) Utility.click_option(self.driver, element=link) return self.new_email
def student_scores(self): """Click on the 'Student Scores' button. :return: the instructor scores page :rtype: :py:class:`~pages.tutor.scores.Scores` """ button = self.find_element(*self._student_scores_locator) Utility.click_option(self.driver, element=button) from pages.tutor.scores import Scores return go_to_(Scores(self.driver, self.page.base_url))
def toggle_password_display(self) -> ChangePassword: """Toggle the password field to show or hide the value. :return: the Accounts log in page :rtype: :py:class:`~pages.accounts.home.AccountsHome` """ toggle = self.find_element(*self._show_password_toggle_locator) Utility.click_option(self.driver, element=toggle) sleep(0.1) return self.page
def select(self, option): """Select a mobile menu option.""" if option == self.current_menu_item or not self.is_phone: return self menu = self.find_element(*self._menu_select_locator) Utility.click_option(self.driver, element=menu) for section in self.menu_options: if section.text == option: Utility.click_option(self.driver, element=section) return self raise (ValueError('"{0}" is not an available section'.format(option)))
def topic(self, subject): """Set the message topic.""" if subject not in Web.TOPICS: raise ValueError('{0} is not a recognized contact topic' .format(subject)) if 'open' not in self.topic_drop_down.get_attribute('class'): Utility.click_option(self.driver, element=self.topic_drop_down) for option in self.find_elements(*self._option_locator): if subject == option.get_attribute('data-value'): Utility.click_option(self.driver, element=option) return self
def select(self) -> Practice: """Click the icon to view the practice step. :return: the practice session with the selected step in the practice window :rtype: :py:class:`~pages.tutor.practice.Practice` """ Utility.click_option(self.driver, element=self.root) sleep(1) return self.page.page
def show_teacher_content(self): """Click on the teacher content toggle. :return: the reference book :rtype: :py:class:`ReferenceBook` """ toggle = self.teacher_content_toggle if toggle: Utility.click_option(self.driver, element=toggle) return self.page
def find_out_more(self): """Access the Salesforce LMS integration overview. :return: the LMS integration walkthrough on Salesforce :rtype: :py:class:`~pages.salesforce.home.Salesforce` """ link = self.find_element(*self._integration_help_locator) Utility.switch_to(self.driver, element=link) from pages.salesforce.home import Salesforce return go_to_(Salesforce(self.driver))
def go_to_rice(self) -> Rice: """Click on the Rice logo to view the Rice University home page. :return: the Rice University home page :rtype: :py:class:`~pages.rice.home.Rice` """ logo = self.rice_logo url = logo.get_attribute('href') Utility.switch_to(self.driver, element=logo) return go_to_external_(Rice(self.driver), url)