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

After trying select value in a Combobox that have already selected, Combobox remains expanded. #168

Closed
elbit61 opened this issue Oct 28, 2013 · 3 comments

Comments

@elbit61
Copy link

elbit61 commented Oct 28, 2013

Hello, there
I met a problem in a Select method for a combobox: after try to select value that have already selected, combo box remains in expanded state.

This is help me:

public static void SelectItemAndClose(this ComboBox target, string itemText)
{
target.Select(itemText);
CollapseComboBox(target);
}

public static void SelectItemAndClose(this ComboBox target, int index)
{
target.Select(index);
CollapseComboBox(target);
}

private static void CollapseComboBox(ComboBox target)
{
var ecp = target.AutomationElement.GetPattern(ExpandCollapsePattern.Pattern);
if (ecp != null && ecp.Current.ExpandCollapseState == ExpandCollapseState.Expanded)
{
ecp.Collapse();
}
}

Thanks.

@ilya-murzinov
Copy link
Contributor

Confirmed, looking into it.

@ilya-murzinov
Copy link
Contributor

Pull request #196.

@rvipandey
Copy link

i did not able to find GetPattern method in

    private static void CollapseComboBox(TestStack.White.UIItems.ListBoxItems.ComboBox target)
    {
        var ecp = target.AutomationElement.GetPattern
    }

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

4 participants