def copy_to_clipboard(): """Return the value copied to clipboard.""" time.sleep(Settings.DEFAULT_UI_DELAY) edit_select_all() time.sleep(Settings.DEFAULT_UI_DELAY) edit_copy() time.sleep(Settings.DEFAULT_UI_DELAY) value = get_clipboard() time.sleep(Settings.DEFAULT_UI_DELAY) logger.debug("Copied to clipboard: %s" % value) return value
def get_support_info(): """Returns support information as a JSON object from 'about:support' page.""" copy_raw_data_to_clipboard = Pattern( "about_support_copy_raw_data_button.png") new_tab() select_location_bar() paste("about:support") type(Key.ENTER) time.sleep(Settings.DEFAULT_UI_DELAY) try: click(copy_raw_data_to_clipboard) time.sleep(Settings.DEFAULT_UI_DELAY_LONG) json_text = get_clipboard() return json.loads(json_text) except Exception as e: raise APIHelperError( "Failed to retrieve support information value.\n{}".format(e)) finally: close_tab()
def get_telemetry_info(): """Returns telemetry information as a JSON object from 'about:telemetry' page. """ copy_raw_data_to_clipboard_pattern = Pattern( "copy_raw_data_to_clipboard.png") raw_json_pattern = Pattern("raw_json.png") raw_data_pattern = Pattern("raw_data.png") new_tab() paste("about:telemetry") type(Key.ENTER) try: wait(raw_json_pattern, 10) logger.debug("'RAW JSON' button is present on the page.") click(raw_json_pattern) except (FindError, ValueError): raise APIHelperError("'RAW JSON' button not present in the page.") try: wait(raw_data_pattern, 10) logger.debug("'Raw Data' button is present on the page.") click(raw_data_pattern) except (FindError, ValueError): close_tab() raise APIHelperError("'Raw Data' button not present in the page.") try: click(copy_raw_data_to_clipboard_pattern) time.sleep(Settings.DEFAULT_UI_DELAY) json_text = get_clipboard() return json.loads(json_text) except Exception: raise APIHelperError( "Failed to retrieve raw message information value.") finally: close_tab()