Omenia / robotframework-whitelibrary

Library for automating Windows GUI technologies with Robot Framework. WhiteLibrary wraps the White automation framework.
Apache License 2.0
54 stars 15 forks source link

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

Open chjsoliveira opened 4 years ago

chjsoliveira commented 4 years ago

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)
                )`