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)
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)
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)
def open_web_developer_menu(): """ Open the Web_developer tool. """ type(text=Key.F2, modifier=KeyModifier.SHIFT)
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)
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)
def navigate_home(): """Navigate the browser to whatever is set as the Home page.""" type(text=Key.HOME, modifier=KeyModifier.ALT)
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)
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)
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)
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)
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)
def open_search_manager(): """If the search bar has focus, open the search engine manager.""" type(text=Key.DOWN, modifier=KeyModifier.ALT)
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)
def close_find(): """Close the regular find toolbar or quick find toolbar, if it has focus.""" type(text=Key.ESC)
def toggle_audio(): """Mute/Unmute audio.""" type(text='m', modifier=KeyModifier.CTRL)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
def next_tab(): """Focus the next tab (one over to the right).""" type(text=Key.TAB, modifier=KeyModifier.CTRL)
def stop_page_load(): """Stop the current in progress web page from loading.""" type(text=Key.ESC)
def previous_tab(): """Focus the previous tab (one over to the left).""" type(text=Key.TAB, modifier=KeyModifier.CTRL + KeyModifier.SHIFT)