arjuna.tpi.guiauto.widget.multielement module

class arjuna.tpi.guiauto.widget.multielement.GuiMultiElement(gui, wmd, elements=None, dispatcher=None)

Bases: arjuna.tpi.engine.asserter.AsserterMixIn, arjuna.tpi.engine.asserter.IterableAsserterMixin, arjuna.tpi.guiauto.base.locatable.Locatable, arjuna.interact.gui.auto.base.dispatchable._Dispatchable

Represents multiple GuiElements found using a same GuiWidgetDefinition.

Not meant to be directly created. It is created using calls from Gui object or GuiNamespace object of Gui.

Parameters:
  • guiGui object containing this GuiMultiElement.
  • wmd – GuiElementMetaData object.
  • elements – (optional) List of GuiElements to populate this object instead of locating it.

Note

It supports an index based retrieval of a contained GuiElement:

multielement[<index>]

It also supports looping:

for element in multi_element:
    some element code
are_selected() → bool

Check if all GuiElements in this GuiMultiElement are in selected state.

elements

List of GuiElements in this GuiMultiElement

filter

GuiMultiElementFilter object for this GuiMultiElement

first_element

First GuiElement in this GuiMultiElement.

first_selected_element

First GuiElement which is in selected state.

get_element_at_ordinal(ordinal: int) → arjuna.tpi.guiauto.widget.element.GuiElement

Get GuiElement at an ordinal (position) in this GuiMultiElement.

Ordinals are as per human counting. First element is at ordinal 1.

get_element_by_value(value: str) → arjuna.tpi.guiauto.widget.element.GuiElement

Get GuiElement in this GuiMultiElement whose value attribute content is as supplied.

Parameters:value – Value attribute content of this target GuiElement.
get_element_by_visible_text(text: str) → arjuna.tpi.guiauto.widget.element.GuiElement

Get GuiElement in this GuiMultiElement whose text is as supplied.

Parameters:text – Text of this target GuiElement.
has_index_selected(index: int) → arjuna.tpi.guiauto.widget.element.GuiElement

Check if GuiElement at the given index is in selected state.

has_ordinal_selected(ordinal)

Check if GuiElement at the given ordinal is in selected state.

Ordinals are as per human counting. First element is at ordinal 1.

last_element

Last GuiElement in this GuiMultiElement.

length

Number of GuiElements in this object.

random_element

A GuiElement chosen at random from GuiElments in this GuiMultiElement.

size

Number of GuiElements in this object.

source

GuiSource for this GuiMultiElement.

class arjuna.tpi.guiauto.widget.multielement.GuiMultiElementFilter(gui_multi_element)

Bases: object

Build a new GuiMultiElement by filtering an existing one.

Parameters:gui_multi_element – Existing GuiMultiElement object.
active() → self

Choose only active/non-stale GuiElement s.

Returns:Current GuiMultiElementFilter object
attr(name) → self

Choose only GuiElement objects which contain the given attribute.

Parameters:name – Name of attribute
Returns:Current GuiMultiElementFilter object
attr_value(name, value) → self

Choose only GuiElement objects which contain the given attribute and its value.

Parameters:
  • name – Name of attribute
  • value – Full or partial content of the given attribute
Returns:

Current GuiMultiElementFilter object

build() → arjuna.tpi.guiauto.widget.multielement.GuiMultiElement

Build a new GuiMultiElement.

text(text) → self

Choose only GuiElement objects whose text contains the text provided.

Parameters:text – Full or partial text.
Returns:Current GuiMultiElementFilter object
value(value) → self

Choose only GuiElement objects whose value attribute matches the value argument provided.

Parameters:value – Full or partial content of value attribute.
Returns:Current GuiMultiElementFilter object
visible() → self

Choose only visible GuiElement objects.

Returns:Current GuiMultiElementFilter object