Exemplo n.º 1
0
def quit_firefox():
    """Quit the browser."""

    # Wait before quiting Firefox to avoid concurrency.
    time.sleep(Settings.FX_DELAY)
    if Settings.get_os() == Platform.MAC:
        type(text='q', modifier=KeyModifier.CMD)
    elif Settings.get_os() == Platform.WINDOWS:
        type(text='w', modifier=KeyModifier.CTRL + KeyModifier.SHIFT)
    else:
        type(text='q', modifier=KeyModifier.CTRL)
Exemplo n.º 2
0
def select_tab(num):
    """Select a given tab (only 1-8).

    param:  num  is a string 1-8. example: '4'.
    """
    if Settings.getOS() == Platform.MAC:
        type(text=num, modifier=KeyModifier.CMD)
    elif Settings.getOS() == Platform.WINDOWS:
        type(text=num, modifier=KeyModifier.CTRL + KeyModifier.SHIFT)
    else:
        type(text=num, modifier=KeyModifier.CTRL)
Exemplo n.º 3
0
def force_reload_page():
    """Reload the current web page with cache override."""
    if Settings.get_os() == Platform.MAC:
        type(text='r', modifier=KeyModifier.CMD + KeyModifier.SHIFT)
    else:
        type(text='r', modifier=KeyModifier.CTRL + KeyModifier.SHIFT)
Exemplo n.º 4
0
def open_web_developer_menu():
    """
    Open the Web_developer tool.
    """
    type(text=Key.F2, modifier=KeyModifier.SHIFT)
Exemplo n.º 5
0
def open_page_source():
    """Open the current page's page source."""
    if Settings.get_os() == Platform.MAC:
        type(text='u', modifier=KeyModifier.CMD)
    else:
        type(text='u', modifier=KeyModifier.CTRL)
Exemplo n.º 6
0
def open_file_picker():
    """Open the system file picker."""
    if Settings.get_os() == Platform.MAC:
        type(text='o', modifier=KeyModifier.CMD)
    else:
        type(text='o', modifier=KeyModifier.CTRL)
Exemplo n.º 7
0
def navigate_home():
    """Navigate the browser to whatever is set as the Home page."""
    type(text=Key.HOME, modifier=KeyModifier.ALT)
Exemplo n.º 8
0
def undo_close_window():
    """Re-opens the previously closed browser window."""
    if Settings.get_os() == Platform.MAC:
        type(text='n', modifier=KeyModifier.CMD + KeyModifier.SHIFT)
    else:
        type(text='n', modifier=KeyModifier.CTRL + KeyModifier.SHIFT)
Exemplo n.º 9
0
def navigate_back():
    """Navigate back in browsing history one page visit."""
    if Settings.get_os() == Platform.MAC:
        type(text='[', modifier=KeyModifier.CMD)
    else:
        type(text=Key.LEFT, modifier=KeyModifier.ALT)
Exemplo n.º 10
0
def force_close():
    """Move to the previous frame (can be in content or in chrome)."""
    type(text=Key.F4, modifier=KeyModifier.ALT)
    type(text='u', modifier=KeyModifier.CTRL)
Exemplo n.º 11
0
def close_window():
    """Close the currently focused window."""
    if Settings.get_os() == Platform.MAC:
        type(text='w', modifier=KeyModifier.CMD + KeyModifier.SHIFT)
    else:
        type(text='w', modifier=KeyModifier.CTRL + KeyModifier.SHIFT)
Exemplo n.º 12
0
def close_tab():
    """Close the currently focused tab (Except for app tabs)."""
    if Settings.get_os() == Platform.MAC:
        type(text='w', modifier=KeyModifier.CMD)
    else:
        type(text='w', modifier=KeyModifier.CTRL)
Exemplo n.º 13
0
def open_search_manager():
    """If the search bar has focus, open the search engine manager."""
    type(text=Key.DOWN, modifier=KeyModifier.ALT)
Exemplo n.º 14
0
def select_search_bar():
    """If the search bar is present, select the search bar, otherwise this selects the location bar."""
    if Settings.get_os() == Platform.MAC:
        type(text='k', modifier=KeyModifier.CMD)
    else:
        type(text='k', modifier=KeyModifier.CTRL)
Exemplo n.º 15
0
def close_find():
    """Close the regular find toolbar or quick find toolbar, if it has focus."""
    type(text=Key.ESC)
Exemplo n.º 16
0
def toggle_audio():
    """Mute/Unmute audio."""
    type(text='m', modifier=KeyModifier.CTRL)
Exemplo n.º 17
0
def undo_close_tab():
    """Re-opens the previously closed tab."""
    if Settings.get_os() == Platform.MAC:
        type(text='t', modifier=KeyModifier.CMD + KeyModifier.SHIFT)
    else:
        type(text='t', modifier=KeyModifier.CTRL + KeyModifier.SHIFT)
Exemplo n.º 18
0
def change_window_view():
    """Change the focus on another window."""
    if Settings.get_os() == Platform.MAC:
        type(text=Key.TAB, modifier=KeyModifier.CMD)
    else:
        type(text=Key.TAB, modifier=KeyModifier.ALT)
Exemplo n.º 19
0
def history_sidebar():
    """Toggle open/close the history sidebar."""
    if Settings.get_os() == Platform.MAC:
        type(text='h', modifier=KeyModifier.CMD + KeyModifier.SHIFT)
    else:
        type(text='h', modifier=KeyModifier.CTRL)
Exemplo n.º 20
0
def full_screen():
    """Toggle full screen mode."""
    if Settings.get_os() == Platform.MAC:
        type(text='f', modifier=KeyModifier.CMD + KeyModifier.SHIFT)
    else:
        type(text=Key.F11)
Exemplo n.º 21
0
def clear_recent_history():
    """Open the Clear Recent History dialog."""
    if Settings.get_os() == Platform.MAC:
        type(text=Key.DELETE, modifier=KeyModifier.CMD + KeyModifier.SHIFT)
    else:
        type(text=Key.DELETE, modifier=KeyModifier.CTRL + KeyModifier.SHIFT)
Exemplo n.º 22
0
def new_window():
    """Open a new browser window."""
    if Settings.get_os() == Platform.MAC:
        type(text='n', modifier=KeyModifier.CMD)
    else:
        type(text='n', modifier=KeyModifier.CTRL)
Exemplo n.º 23
0
def open_addons():
    """Open the Add-ons Manager page."""
    if Settings.get_os() == Platform.MAC:
        type(text='a', modifier=KeyModifier.CMD + KeyModifier.SHIFT)
    else:
        type(text='a', modifier=KeyModifier.CTRL + KeyModifier.SHIFT)
Exemplo n.º 24
0
def new_private_window():
    """Open a new private browser window."""
    if Settings.get_os() == Platform.MAC:
        type(text='p', modifier=KeyModifier.CMD + KeyModifier.SHIFT)
    else:
        type(text='p', modifier=KeyModifier.CTRL + KeyModifier.SHIFT)
Exemplo n.º 25
0
def open_web_console():
    """Opens the Web Console."""
    if Settings.get_os() == Platform.MAC:
        type(text='k', modifier=KeyModifier.CMD + KeyModifier.ALT)
    else:
        type(text='k', modifier=KeyModifier.CTRL + KeyModifier.SHIFT)
Exemplo n.º 26
0
def navigate_forward():
    """Navigate forward in browsing history one page visit."""
    if Settings.get_os() == Platform.MAC:
        type(text=']', modifier=KeyModifier.CMD)
    else:
        type(text=']', modifier=KeyModifier.ALT)
Exemplo n.º 27
0
def reload_page():
    """Reload the current web page."""
    if Settings.get_os() == Platform.MAC:
        type(text='r', modifier=KeyModifier.CMD)
    else:
        type(text='r', modifier=KeyModifier.CTRL)
Exemplo n.º 28
0
def next_tab():
    """Focus the next tab (one over to the right)."""
    type(text=Key.TAB, modifier=KeyModifier.CTRL)
Exemplo n.º 29
0
def stop_page_load():
    """Stop the current in progress web page from loading."""
    type(text=Key.ESC)
Exemplo n.º 30
0
def previous_tab():
    """Focus the previous tab (one over to the left)."""
    type(text=Key.TAB, modifier=KeyModifier.CTRL + KeyModifier.SHIFT)