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


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.


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 will try to search for on screen.
Returns:If the match is found returns True else False.

Get the text of the banner above the console screen.


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:


Return the text from a text console.

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


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

pretty_attrs = ['appliance_handle', 'browser', 'console_handle', 'name']

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


Press the fullscreen button in the console tab.


Send text to the console.


Switch focus to appliance tab/window.


Switch focus to console tab/window.


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.

  • 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.