ConsoleUser

Copyright (c) 2010-2023 Skaion Corporarion, www.skaion.com

This project was developed in part by numerous sponsorships from the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints of Governmental purposes notwithstanding any copyright notation thereon.

All content reflects those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the U.S. Government or Skaion Corporation.

class Window.Window(system, config, app=None)

I encapsulate all the information about a window, and how to interact with it.

Parameters:

  • system: a handle to the remote <no title> on which this window “lives”

  • config: a <no title> object

  • app: if present, its a handle to the application controlling this Window

click_titlebar()

Click anywhere in the titlebar (that isn’t a button we know about)

contains(target, move_mouse=True, scroll=False)

Return whether or not this Window contains the given target

contains_above(target, anchor)

This will check if the <no title> target is found within this Window above the <no title> anchor.

Parameters:

Return: True if target is above anchor, False if it is

equal to or below anchor, or None if at least one of them was not found

contains_below(target, anchor)

This will check if the <no title> target is found within this Window below the <no title> anchor.

Parameters:

Return: True if target is below anchor, False if it is

equal to or above anchor, or None if at least one of them was not found

contains_text(text, text_types, scroll=False)

Return whether or not the current window contains the given text

Parameters:

  • text: the text to find

  • text_types: the list of possible ways the text could be displayed

  • scroll: whether or not to scroll the page if it is not currently visible

corners_valid()

Check if the corners we saved for this window still seem to be correct, given that the window still has focus.

count_matches(target)

Count how many times this target appears within this window.

find_panel(bounds, outer=False)

Given the bounds that define a panel within this window, find that panel and return a handle that can be used to restrict future searches

Parameters:

  • bounds: a sequence of Regions that define the corners of the panel in question

  • outer: if True use the outer most dimensions of each matched corner

find_regions_with_scroll(region)

Find the region within this window including scrolling the window if needed.

Parameters:

Return: the coordinates of all matches visible at the time

get_focus()

Switch the system so that this window has focus.

Return: a boolean indicating whether or not this failed

has_dialog(dialog)

This window might have spawned a dialog, so try to find it.

Parameters:

  • dialog: the description/<no title> identifying the dialog

has_focus()

Tell whether or not this window has focus. Obviously this may not always be 100% reliable, but hopefully it works most of the time.

Return: a boolean whether or not this window has focus

move_mouse_out()

Move the mouse outside the current window

move_within(avoids=())

Move the mouse to a random location within this window.

not_contains(target)

Return whether or not this Window contains the given target

panel_from_region(region, select=<function select_random>)

Given the bounds that define a panel within this window, find that panel and return a handle that can be used to restrict future searches

Parameters:

  • region: a Region that defines the panel

save_state()

Save the current state of this window – assuming it is currently on top.

scroll_to_bottom()

Scroll the current window to the bottom.

scroll_to_top()

Scroll the current window until it’s at the top.

set_app(app)

Update the app associated with this Window

should_be_focused()

Sometimes it seems that we do not have focus, often because the title of the window doesn’t match expectation, but we might be able to use the taskbar to tell that we do in fact have focus anyway.

This will return whether or not the taskbar suggests that our app does in fact have focus.

Window.get_window(system, config, win_type, app=None)

Get a Window of the appropriate type