Xamarin UI Test Failed: System.InvalidOperationException : Sequence contains no matching element. RRS feed

  • Question

  • User341975 posted

    I used to be able to run my unit previously, with this configuration in Start Up using Xamarin UI test. Here’s the setup configuration.

                    return ConfigureApp.Android.ApkFile(@"/Users/user101/Develop/Builds/Android/DemoApp.Android.apk")

    When I run it now on MAC, on an Android Device, I’m getting a blank screen with this error message.

    Error: System.InvalidOperationException : Sequence contains no matching element.

    I’m currently using all the latest tools.

    Xcode: 11.6 Xamrin.UITest: 3.0.7 Visual Studio for Mac: 8.6.6 (build 11)

    Any insights as to why I’m getting this error message?


    Thursday, July 23, 2020 3:31 AM

All replies

  • User369979 posted

    I found these threads having the same error message as yours: https://stackoverflow.com/questions/42717656/sequence-contains-no-elements-in-xamarin-forms-for-listview/42717745 https://stackoverflow.com/questions/44632302/sequence-contains-no-elements-error?rq=1 What does your content page look like? Try to check if you assigned more than one control in its content.

    Thursday, July 23, 2020 8:11 AM
  • User341975 posted

    Mine is related more with Xamarin.UI Testing. It works fine when I run it in the Emulator. However, it displays a blank screen with the aforementioned error message when conducting a UI Test. Here's the Xaml.

                        <StackLayout VerticalOptions="FillAndExpand"
                            <Label Text="Tom Jones"

    Here's the UI test.

                    public async Task MainPage_UITest()
                      var appResult = app.Query("FullNameLabel").First(result => result.Text == "Tom Jones");
                      Assert.IsTrue(appResult != null, "Label is not displaying the right result!");
                       app.Screenshot("Main page");
    Thursday, July 23, 2020 6:07 PM