how to query a child element, present inside a list item RRS feed

  • Question

  • User392365 posted

    I want to automate the below scenario : The List has several rows and each row has different elements inside it. I want to iterate through the list and find elements inside each row using Xamarin.

    IList CellList= app.Query(thisObject => thisObject.Id("MyList_ID"));

    foreach(var element in CellList) {

    //Here i want to go inside each row and find an element inside each row. So what needs to be changed in the below line of code ?

    bool isNTextPresent = (app.Query(thisObject => thisObject.Id("NText_ID")).Length) == 1 ? true : false; Assert.AreEqual(isNTextPresent , true); }

    Monday, May 18, 2020 9:09 AM

All replies

  • User371688 posted

    If I understand your correctly, do you want Xamarin.UITest.Queries.AppQuery.Sibling(string) ?

    There is a similar thread, you can check it here: https://forums.xamarin.com/discussion/139966/xamarin-uitest-how-to-click-on-the-particular-element-of-listview

    For more details, you can check: https://docs.microsoft.com/en-us/dotnet/api/xamarin.uitest.queries.appquery.sibling?view=xamarin-uitest-sdk

    Tuesday, May 19, 2020 6:39 AM
  • User392365 posted

    I have gone through these links. But i couldn't find the solution to my problem. Actually my question is : to query normally we use app.query(a => a.Id("someID")) . But how to query inside a list ? i.e.., in selenium : IList MyList; IWebElement element1 = MyList.FindElements(By........); I want to do something like this. Could you please give me the code for this in Xamarin ?

    Tuesday, May 19, 2020 7:14 AM