Wait for element in UserCode without repository item?

Ask general questions here.
mrt
Posts: 88
Joined: Mon Mar 16, 2020 11:31 am

Wait for element in UserCode without repository item?

Post by mrt » Wed Apr 14, 2021 12:46 pm

Dear all,

I am aware of the functionality:

Code: Select all

repoItemInfo.WaitForExists(500)
which works well.

But currently I have to search for an element inside a list which is NOT in the repository and use the Wait functionality on it, and I am out of ideas.

Use case File upload:
So I have a button to upload multiple files to a webpage.
While uploading, a list is shown and each file shows a separate progress bar.
When uploading is finished, the progress bar disappears.

So my approach is:
  • start upload
  • find element with current filename and progress bar
  • wait until progress bar disappears
  • validate filename
So I pass the filelistInfo to the user code method and trigger the upload,
then I create an adapter for the filelist and search for the element.

Code: Select all

DivTag filelist = filelistInfo.CreateAdapter<DivTag>(true);
DivTag uploading = filelist.FindSingle<DivTag>(".//div[@class~'loading']/div[@class='item-name' and @innertext='" + myFileName + "']");
So long, so good.

BUT:
As next step I want to wait until this item does not exist anymore to proceed, but I have no idea how?

I can't use the RepoItemInfo.Exists() because I have the element and not the Info-object of it (which is not possible to obtain from code as I have learned).

Is there any other implementation of this Exists() function, where I can pass the element as argument, something like

Code: Select all

WaitForExists(myElement)
or do you have any other ideas?

thank you, BR mrt

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

Re: Wait for element in UserCode without repository item?

Post by odklizec » Wed Apr 14, 2021 1:30 pm

Hi mrt,

I'm afraid, WaitForExists is purely repoinfo related method. So if repository is out of question here, you will have to implement your own "wait" method, for given xpath. Check this discussion with quick&dirty sample I made some time ago...
waitfornotexists-on-type-element-t9314.html#p37537
Hope this helps?
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

mrt
Posts: 88
Joined: Mon Mar 16, 2020 11:31 am

Re: Wait for element in UserCode without repository item?

Post by mrt » Wed Apr 14, 2021 2:37 pm

alright, does the trick, thanks!