Exemple #1
0
def remove_zoom_indicator_from_toolbar():
    """Remove the zoom indicator from toolbar by clicking on the 'Remove from
    Toolbar' button.
    """

    zoom_control_toolbar_decrease_pattern = NavBar.ZOOM_OUT
    remove_from_toolbar_pattern = Pattern("remove_from_toolbar.png")

    try:
        wait(zoom_control_toolbar_decrease_pattern,
             FirefoxSettings.FIREFOX_TIMEOUT)
        logger.debug("'Decrease' zoom control found.")
        right_click(zoom_control_toolbar_decrease_pattern)
    except FindError:
        raise APIHelperError(
            "Can't find the 'Decrease' zoom control button in the page, \
            aborting.")

    try:
        wait(remove_from_toolbar_pattern, FirefoxSettings.FIREFOX_TIMEOUT)
        logger.debug("'Remove from Toolbar' option found.")
        click(remove_from_toolbar_pattern)
    except FindError:
        raise APIHelperError(
            "Can't find the 'Remove from Toolbar' option in the page, \
            aborting.")

    try:
        wait_vanish(zoom_control_toolbar_decrease_pattern,
                    FirefoxSettings.FIREFOX_TIMEOUT)
    except FindError:
        raise APIHelperError(
            "Zoom indicator not removed from toolbar, aborting.")
Exemple #2
0
def right_click_and_type(target, delay=None, keyboard_action=None):
    right_click(target)
    if delay:
        time.sleep(delay)
    else:
        time.sleep(Settings.DEFAULT_UI_DELAY_LONG)
    type(text=keyboard_action)
Exemple #3
0
    def right_click(self, lps=None, duration=None, align=None):
        """Mouse right click.

        :param lps: Location, Pattern or String.
        :param duration: Speed of hovering from current location to target.
        :param align: Click location alignment could be top_left, center, top_right, bottom_left, bottom_right.
        :return: None.
        """
        return right_click(lps, duration, self._area, align)
Exemple #4
0
def open_bookmarks_toolbar():
    """ Open the Bookmarks Toolbar using the context menu from the navigation bar """

    home_button = NavBar.HOME_BUTTON
    w, h = home_button.get_size()
    horizontal_offset = w * 1.7
    navbar_context_menu = home_button.target_offset(horizontal_offset, 0)

    try:
        right_click(navbar_context_menu)
        click(NavBar.ContextMenu.BOOKMARKS_TOOLBAR)
        logger.debug(
            "Click is performed successfully on Bookmarks Toolbar option from navigation bar context menu."
        )
    except FindError:
        raise APIHelperError(
            "Could not open the Bookmarks Toolbar using context menu from the navigation bar."
        )

    restore_firefox_focus()