cfme.common.vm_console module

Module containing classes with common behaviour for consoles of both VMs and Instances of all types.

class cfme.common.vm_console.ConsoleMixin[source]

Bases: object

A mixin to provide methods to get a vm console object

classmethod console_handle(browser)[source]

The basic algorithm for getting the consoles window handle is to get the appliances window handle and then iterate through the window_handles till we find one that is not the appliances window handle. Once we find this check that it has a canvas widget with a specific ID

vm_console

Get the consoles window handle, and then create a VMConsole object, and store the VMConsole object aside.

class cfme.common.vm_console.VMConsole(vm, console_handle, appliance_handle)[source]

Bases: cfme.utils.pretty.Pretty

Class to manage the VM Console. Presently, only support HTML5/WebMKS Console.

close_console_window()[source]

Attempt to close Console window at the end of test.

find_text_on_screen(text_to_find, current_line=False)[source]

Find particular text is present on Screen.

This function uses get_screen_text function to get string containing the text on the screen and then tries to match it against the ‘text_to_find’.

Parameters:text_to_find – This is what re.search will try to search for on screen.
Returns:If the match is found returns True else False.
get_banner()[source]

Get the text of the banner above the console screen.

get_screen(timeout=15)[source]

Retrieve the bit map from the canvas widget that represents the console screen.

Returns it as a binary string.

Implementation: The canvas tag has a method toDataURL() which one can use in javascript to obtain the canvas image base64 encoded. Examples of how to do this can be seen here:

get_screen_text()[source]

Return the text from a text console.

Uses OCR to scrape the text from the console image taken at the time of the call.

is_connected()[source]

Wait for the banner on the console to say the console is connected.

pretty_attrs = ['appliance_handle', 'browser', 'console_handle', 'name']
send_ctrl_alt_delete()[source]

Press the ctrl-alt-delete button in the console tab.

send_fullscreen()[source]

Press the fullscreen button in the console tab.

send_keys(text)[source]

Send text to the console.

switch_to_appliance()[source]

Switch focus to appliance tab/window.

switch_to_console()[source]

Switch focus to console tab/window.

wait_for_connect(timeout=30)[source]

Wait for as long as the specified/default timeout for the console to be connected.

wait_for_text(timeout=45, text_to_find='', to_disappear=False)[source]

Wait for as long as the specified/default timeout for the ‘text’ to show up on screen.

Parameters:
  • timeout – Wait Time before wait_for function times out.
  • text_to_find – value passed to find_text_on_screen function
  • to_disappear – if set to True, function will wait for text_to_find to disappear from screen.