lib/Element/Checkbox.pm

is_checked(%args)

is_checked(checked_needle => $checked_needle, unchecked_needle => $unchecked_needle);

The method to verify if the checkbox is checked or not.

$checked_needle - String, needle tag for checkbox in checked state; $unchecked_needle - String, needle tag for checkbox in unchecked state.

NOTE: To use the method, the appropriate needles with the checked and unchecked states should be added to the needles repository.

Returns 1 if the checkbox is checked, otherwise returns 0.

Example:

There is the checkbox with 'Test' label.

First of all create two needles for it:
* in checked state with 'checked_test_checkbox' tag;
* in unchecked state with 'unchecked_test_checkbox' tag.

Then use the method:

is_checked(checked_needle   => 'checked_test_checkbox',
           unchecked_needle => 'unchecked_test_checkbox');

set_state(%args)

set_state(state => $state, shortcut => $shortcut, needle_postfix => $needle_postfix);

The method to set the checkbox to checked or unchecked state, regardless of the current state of the checkbox.

$state - Boolean, specifies whether to check (1) or uncheck (0) the checkbox; $shortcut - String, keyboard shortcut for the checkbox (e.g. alt-a); $checked_needle - String, needle tag for checkbox in checked state; $unchecked_needle - String, needle tag for checkbox in unchecked state.

NOTE: To use the method, the appropriate needles with the checked and unchecked states should be added to the needles repository.

Example:

There is a checkbox. It is required to test the functionality that it
enables and do not care about the default state of the checkbox.

Assume, needles for checked/unchecked states already created.

Method usage:

set_state(state            => 1,
          shortcut         => 'alt-a',
          checked_needle   => 'checked_test_checkbox',
          unchecked_needle => 'unchecked_test_checkbox'
);