WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

UWP - Changing ComboBox selection

Open dawsongh opened this issue 9 years ago • 4 comments

I have appium and the WinAppDriver testing my UWP in a Unit Test project in VS2017. My UWP app is starting up ok and I can navigate to the page required.

On my page I have a set of ComboBox UI items and I would like to change the selection in the combobox, how is this done for UWP and WinAppDriver?

TIA

dawsongh avatar Dec 01 '17 17:12 dawsongh

Hi @dawsongh,

We have some sample test tailored specifically for each UWP XAML control including ComboBox UI below: https://github.com/Microsoft/WinAppDriver/blob/v1.0/Tests/UWPControls/ComboBox.cs

You can follow the Click test method to select an item and Text test method to retrieve the value of the selected item. Feel free to contribute to this particular test sample if you find a crucial UWP XAML control missing.

timotiusmargo avatar Dec 01 '17 19:12 timotiusmargo

Hi Timotius,

Thanks, that helped and I have it working but I also have my own UserControls on the page; is there an example building test cases using our own user controls. One on my controls has two common UI controls, a TextBox and a ComboBox so I really need to set two sun controls using test cases.

Any thoughts or ideas?

Thanks

Dawson

dawsongh avatar Dec 07 '17 16:12 dawsongh

Hi @dawsongh, From the pagesource attribute, you can find the UI tree, and from there you may be able to infer on how to interact with the controls.

For a few standard controls, we have a sample application here: https://github.com/Microsoft/WinAppDriver/tree/v1.0/ApplicationUnderTests/AppUIBasics Corresponding test cases for this sample can be found here: https://github.com/Microsoft/WinAppDriver/tree/v1.0/Tests/UWPControls

hassanuz avatar Dec 09 '17 00:12 hassanuz

Thanks, managed to get it working by using the Tag property so that I can assign a unique name to the same user control placed many times on the UWP page.

dawsongh avatar Dec 13 '17 19:12 dawsongh