Ejemplo n.º 1
0
            def go_to_highlight(self) -> Page:
                """Click the 'Go to highlight' link.

                :return: the book page containing the highlight in a new tab
                :rtype: :py:class:`~pages.content.Content`

                """
                link_url = self.go_to_highlight_link.get_attribute("href").split("/")
                book = link_url[2]
                page = link_url[4].split("?")[0]
                Utilities.switch_to(self.driver, element=self.go_to_highlight_link)
                from pages.content import Content
                return Content(
                    driver=self.driver,
                    base_url=Utilities.parent_page(self).base_url,
                    book_slug=book,
                    page_slug=page
                )
Ejemplo n.º 2
0
 def book_status_on_amazon(self):
     """Open the Book Order modal."""
     try:
         print_locator = (self._print_copy_mobile_locator
                          if self.is_mobile else self._print_copy_locator)
         individual_locator = (self._individual_copy_locator
                               if self.is_mobile else
                               self._order_a_personal_copy_locator)
         Utilities.click_option(self.driver, locator=print_locator)
         individual = self.find_elements(*individual_locator)
         if individual:
             Utilities.switch_to(self.driver, element=individual[0])
             sleep(1)
             amazon_link = self.current_url
             self.driver.close()
             self.driver.switch_to.window(self.driver.window_handles[0])
             return amazon_link
     except NoSuchElementException:
         return None