IList; is it possible to refresh???

Class library usage, coding and language questions.
NuzakFarnas
Posts: 7
Joined: Tue Nov 05, 2019 5:17 am

IList; is it possible to refresh???

Post by NuzakFarnas » Tue Nov 26, 2019 7:52 am

We have a few screens where repository-items are visible multiple times.
This code clicks on all of them:

Code: Select all

            public void ClickAlleElementen(Ranorex.Core.Repository.RepoItemInfo K2WItem)  
            {

            	IList<Unknown> elementList = K2WItem.CreateAdapters<Unknown>();  
                  
            		foreach (Ranorex.Unknown element in elementList)
                		{  
                    		element.Click();
                		}	
            }
But sometimes clicking on the element means deleting; so the element isn't on the screen anymore, but still in the list. Then we get an error like "Could not get a valid element rectangle from '{DivTag:}', since the element is no longer valid."reverse phone lookupnba reddit pcpartpicker




Is there a way to refresh the IList after clicking on an element?
Last edited by NuzakFarnas on Wed Nov 27, 2019 6:12 am, edited 1 time in total.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5360
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: IList; is it possible to refresh???

Post by odklizec » Tue Nov 26, 2019 8:50 am

Hi,

I think you must simply re-load ilist after click?
foreach (Ranorex.Unknown element in elementList)
{
element.Click();
elementList = K2WItem.CreateAdapters<Unknown>();
}
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration