UWP - Changing ComboBox selection
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
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.
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
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
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.