is it possible to make custom waitforexistence method?

Ask general questions here.
fimo420
Posts: 55
Joined: Wed Jun 20, 2012 9:49 am

is it possible to make custom waitforexistence method?

Post by fimo420 » Wed Jul 18, 2012 2:16 pm

Hi,

I need some help from here about how to make an generic waitforexistance method, is it even possible??
I've been trying to do it but with no luck...
this was my idea, i want to send in anyitem or window and wait for that item till timeout, but since i cannot send in any ranorex generic item it fails there :(

waitforexistance ( Ranorex item?, String timeout){
int time =0;
while(!item.exists()){
Thread.Sleep(1000);
time++;
if(time>timeout)
throw new Exception("Timeout reached");
}
}

I wana send in any item, button, window, listitem etc... is this even possible??
Or maybe there is already something like this which i dont know about :(
Any help would be appreciated, thanks

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: is it possible to make custom waitforexistence method?

Post by Support Team » Wed Jul 18, 2012 3:25 pm

Hi,

Maybe this is what you are searching for:
http://www.ranorex.com/Documentation/Ra ... lidate.htm
In the validation class you find several exists methods where you can set parameters like timeout, Ranorex item, and so on.

Additionally there is an integrated function WaitForDocumentLoaded(), and a function for WaitForNotExists().
Hope this helps.

Regards
Larissa
Ranorex Support Team
.
Image

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: is it possible to make custom waitforexistence method?

Post by omayer » Wed Jul 18, 2012 3:45 pm

Hi Larissa, Is any tutorial for how to read the Doc @ http://www.ranorex.com/Documentation/Ra ... lidate.htm
Thank you
Tipu

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: is it possible to make custom waitforexistence method?

Post by Support Team » Thu Jul 19, 2012 8:41 am

Hi,
I'm sorry, there is no tutorial how to read the Ranorex API Documentation.
But you can read it in the same way as you would read another API. (Just have a look at the methods you are interested in - in this special case it would be the Exists methods. They are listed alphabetical.)
Regards,
Larissa
Ranorex Support Team
.
Image

User avatar
IanF
Posts: 60
Joined: Thu May 24, 2012 12:37 am
Location: Brisbane, Australia
Contact:

Re: is it possible to make custom waitforexistence method?

Post by IanF » Fri Jul 20, 2012 2:07 am

This something done here to wait for the app loading indicator to go away. Hope it helps

Code: Select all

 public static void WaitForLoadingIndicator()
        {
            //UserCodeModule1.cs Start Look Loading Indicator.
            var found = UserCodeModule1.Exists(Test_User_Code.repo.Loading_Item.Loading_IndicatorInfo.AbsolutePath);
            
             if(found)
             {
             	ImgTag imgTag = Test_User_Code.repo.Loading_Item.Loading_Indicator;
             	
             	UserCodeModule1.LoadingIndicator(ref imgTag);
             	//Report.Info("####Loading Indicator Found####");
             }
              else 
            {
            	Report.Info("####Loading Indicator Not Found####");
            }
 			//UserCodeModule1.cs End Look Loading Indicator. 
        }

Code: Select all

 public static bool Exists(RxPath path)
        {
        	Ranorex.Core.Element elem = null;
        	return Host.Local.TryFindSingle(path, new Duration(new TimeSpan(0,0,10)), out elem);
    
        }
        
        public static void LoadingIndicator(ref ImgTag path)
        {
        	while (path.Visible == true)
        	{
        		continue;
        	}
        }
Ian Fraser