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 ATSPIWindow.ATSPIWindow(system, config, app=None)

Provide all the given functions using an AT-SPI interface instead of pixel mapping or other strategies.

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

can_scroll()

For now, ATSPI windows cannot scroll because that’s not how we’re interacting with them.

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

Return whether or not this Window contains the given target

Note that move_mouse and scroll parameters are ignored for this implementation, as they don’t apply to this view of Window objects.

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: ignored for this implenetaion

  • scroll: ignored for this implenetaion

Find the links that are visible on the page currently.

Parameters:

  • rect: an iterable item defining the corners of the region to contain the point

  • link_colors: an iterable item specifying the colors of links to find

Return: a list of tuples of tuples with the outer tuple defining a rectangle and the inner tuple being the upper left and lower right corners

find_regions_with_scroll(region)

ATSPI doesn’t require scrolling to work, so this is a synonym for find_regions_within

find_regions_within(region)

Find the given region within this window.

get_desktop()

Get the whole desktop for this window

get_focus()

Make sure this Window has focus

has_focus()

Return whether this component is currently active or not.

move_mouse_out()

The mouse does not affect matching for these windows so this method becomes a noop.

move_within()

Move the mouse to a random location within this window.

not_contains(target)

Return whether or not this Window contains the given target

save_state()

Make sure this window is/will still be recognizable in future actions

scroll_down(times)

For now do nothing because we do not scroll

scroll_up(times)

For now do nothing because we do not scroll

select(target, offset=(), scroll=False, select_func=<function select_random>, click=True)

Find the given target Region, which may or may not be currently visisble then scroll the screen if needed to find an occurance to select.

Parameters:

  • target: a <no title> to find on the screen

  • offset: ignored for this type of window

  • scroll: ignored for this type of window

  • select_func: how to choose the “right” target if there are multiple matches

  • click: whether the item needs to be clicked to select it

Return: True if a click was made, False otherwise

select_field(label, position=1, text_types=None)

Given the region description for a field, select that so future input will be directed to it.

Parameters:

  • label: the <no title> that defines this field

  • position: ignored for this implementation

select_text(text, text_types, scroll=False, click=True)

Find the given text and click on it.

Parameters:

  • text: the text to find

  • text_types: ignored for this implementation

  • scroll: ignored for this implementation

  • click: ignored for this implementation

should_be_focused()

For some windows the normal has_focus check will give a misleading result. That does not apply to this type of Window though, so this is a synonym for has_focus.

verify_typing(msg, text, hint=None)

Type and verify the given message (which is expected to be in the given text style (e.g., font). If available the hint will be near the area the typing is expected to be.

Parameters:

  • msg: the string message to type

  • text: ignored for this implementation

  • hint: ignored for this implementation