Ask a Question

Access UI elements inside Xamarin.Forms.ListVIew.

SOLVED
hacka87
Contributor

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 10
tristaanogre
Esteemed Contributor

Lesson learned... read the documentation. 🙂

 

https://support.smartbear.com/testcomplete/docs/app-testing/mobile/xamarin-forms/about.html#supporte...


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: