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.
VMConsole
(vm, console_handle, appliance_handle)[source]¶ Bases:
cfme.utils.pretty.Pretty
Class to manage the VM Console. Presently, only support HTML5/WebMKS Console.
-
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 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.
-
pretty_attrs
= ['appliance_handle', 'browser', 'console_handle', 'name']¶
-
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.
-