robotframework-whitelibrary icon indicating copy to clipboard operation
robotframework-whitelibrary copied to clipboard

It is not possible to check if a listbox is empty.

Open chjsoliveira opened this issue 4 years ago • 0 comments

I believe that creating a new function should help, the same can be done for combobox.

def listbox_should_contain_any_value (self, locator) def combobox_should_contain_any_value (self, locator)

` def listbox_should_contain_any_value(self, locator): ""Verifies that a listbox does contain any value.

    Fails if the listbox contains empty value.

    locatoris the locator of the listbox or ListBox item object.
    Locator syntax is explained in Item locators.

    ""
    listbox = self.state._get_typed_item_by_locator(ListBox, locator)

    try:
        listbox.Select(0)
    except UIActionException as error:
        # Check error in case we get UIActionException with another message
        if "cannot be selected as its position" in str(error):
            raise AssertionError (
                u"ListBox with locator '{}' did not contain any value".format(locator)
                )`

chjsoliveira avatar Apr 21 '20 23:04 chjsoliveira