Gui Widgets

GuiElement

So far this was the GuiWidget type that was dicussed in documentation.

Arjuna has more types of widgets covered in the following sections.

GuiMultiElement - Handling Multiple GuiElements Together

Arjuna provides a special abstraction for representing mutliple GuiElements together rather than a raw Python list. This provides an opportunity to include higher level methods for test code authors.

Defining and Using a GuiMultiElement In Code

You can create a GuiElement using the multi_element factory call of a GuiApp (assume app to be GuiApp object):

app.multi_element(<locator_type>=<locator_value>)

Defining GuiMultiElement in GNS and Using it in Code

You can also define a GuiMultiElement in a GNS File.

In the GNS file for a label corresponding to a GuiMultiElement, add the type entry and set it to multi_element, for example:

cat_checkboxes:
  type: multi_element
  name: "delete_tags[]"

In your code, you can create an element of this as usual, however this time you’ll get a GuiMultiElement object instead of GuiElement.

check_boxes = app.gns.cat_checkboxes

Interacting with GuiMultiElement

It provides various properties and methods for a higher level interaction with a sequence of GuiElements.

  • It supports index based retrieval just like a regular list. Indexes start from computer counting (0).
  • In addition to this, it provides propeties like first_element, last_element and random_element.

RadioGroup - Handling Default HTML Radio Group

RadioGroup object in Arjuna represents the Radio Buttons in the UI that belong to a single selection group (have the same name). Here, we cover handling of a default-HTML RadioGroup control which represents multiple <input type=’radio’>` elements which have the same **name attribute value.

Defining and Using a RadioGroup In Code

You can create a RadioGroup using the radio_group factory call of a GuiApp (assume app to be GuiApp object):

app.radio_group(<locator_type>=<locator_value>)

Defining RadioGroup in GNS and Using it in Code

You can also define a RadioGroup in a GNS File.

In the GNS file for a label corresponding to a GuiMultiElement, add the type entry and set it to radio_group, for example:

date_format:
  type: radio_group
  name: date_format

In your code, you can create an element of this as usual, however this time you’ll get a RadioGroup object instead of GuiElement.

element = app.gns.date_format

Interacting with RadioGroup

It provides various properties and methods for a higher level interaction with a radio group.

  • You can select a a by its visible text by calling select_text method of DropDown.
  • RadioGroup provides various enquiry methods - has_value_selected, has_index_selected.
  • RadioGroup also has value enquirable property.
  • You can use two ways of selecting a radio button - select_value to select by value attribute of an option, select_index to select a radio button present at provided index.