Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chjsoliveira opened this issue Apr 21, 2020 · 0 comments
Open

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

chjsoliveira opened this issue Apr 21, 2020 · 0 comments

Comments

@chjsoliveira
Copy link

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)
                )`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant