1

In Xamarin test on Mac, I'm running a test where a picker is opened and the user selects one of two items inside.

For some reason this line:

if (platform == Platform.iOS)
{
    //Invoke the native method selectRow() 
    app.Query(x => x.Class("UIPickerView").Invoke("selectRow", "[value_name]", "inComponent", 0, "animated", true));
}

Where [value_name] is the value of either of two items, Doesn't work.

There is even MSFT doc for it: https://learn.microsoft.com/en-us/appcenter/test-cloud/frameworks/uitest/features/date-time-pickers

And yet it will not work.

Can anyone share how they got this to work?

Using:

Visual Studio for Mac Version 8.10.10

iPhone 12 iOS 15.0 Simulator

Xamarin.UITest Nuget Version 3.2.2

o_w
  • 581
  • 3
  • 12
  • 1
    app.Tap("[value_name]"); – Amjad S. Jan 31 '22 at 17:19
  • Hi, thanks @AmjadSaab, but it doesn't work. When the picker is opened, the value of the first item appears inside the picker control's "box"(on the xaml page side). So when using your line of code, what happens is the box gets the click, and the iOS picker overlay is gone, without a value being set. That is something we have tried, and it doesn't really work. Do you have something that can interact directly with the iOS picker overlay? – o_w Feb 02 '22 at 07:15

0 Answers0