Forum Discussion

hacka87's avatar
hacka87
Contributor
6 years ago
Solved

Access UI elements inside Xamarin.Forms.ListVIew.

Hello!

 

I am working on automated tests for an Instrumented Application using the Xamarin.Forms on Android.

 

After entering the Assemblies for Xamarin Forms in the code of the app by the developers, I can't manage to have access to elements that are contained by the listView, nor with ObjectSpy, nor I can't find a suitable method to access them by code. I am using FullNames to get the elements. Is there another way besides using the Aliases to have access to the items in such a listview? I have tried also with Children, there is no wItem(index) way to do it, there is no SelectItem like in another listView. I need to get the content of the list view and test each element and also do a touch on it, without having to switch to Aliases and this approach. Also FindAll methd does not have any result.

 

  var navigationpage;
  Mobile.SetCurrent("Moto G (5)");
  navigationpage = Aliases.Device.Process////.navigationpage.mainpage.navigationpage;
  navigationpage.page.stacklayout.contentpresenter.absolutelayout.stacklayout.grid.listview.TouchItemXY(0, 690, 157);
  navigationpage.deviceconnectionpage.stacklayout.stacklayout.label.Touch(683, 119);

 

            for (var i = 0; i < listview.wItemCount; i++)
            {
                Log.Message(list.Children);
            }

 

Best Regards,

10 Replies