help on TryFindSingle

Ask general questions here.
sdimbre
Posts: 21
Joined: Wed Sep 07, 2011 12:38 pm

help on TryFindSingle

Post by sdimbre » Wed Sep 07, 2011 12:50 pm

Hi Team,

New to this forum and to ranorex. Presently evaluating ranorex and found good tool.

I am using TryFindSingle to check existance of my object as follows.

Ranorex.Core.Element elem = null;
bool isBtnAvailable = editDig.TryFindSingle("xpathtoElement", out elem);

But this is not giving expected result to me. Is this right code? What should be the second argument expected here? In my case I gave 'out elem' looking at some examples on your site. What is out here?

Please forgive me for dumb questions.

Thanks,
Dimbre.

User avatar
sdaly
Posts: 238
Joined: Mon May 10, 2010 11:04 am
Location: Dundee, Scotland

Re: help on TryFindSingle

Post by sdaly » Wed Sep 07, 2011 1:23 pm

If the item is found then elem will be set to that item and you can use it.

Example -

Code: Select all

Ranorex.Button btn = null;
if(Host.Local.TryFindSingle("rxPath", 10000, out btn){
//path was found and you have a valid adapter
btn.Click();
}else{
Report.Info(rxPath + " didn't exist");
}

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

Re: help on TryFindSingle

Post by Support Team » Wed Sep 07, 2011 1:53 pm

Hi,

You can also use the Validation class, for more information take a look at the following link.
I would also recommend to read all the chapter of our UserGuide, it describes the most important parts of Ranorex.

Regards,
Markus
Ranorex Support Team
.
Image

sdimbre
Posts: 21
Joined: Wed Sep 07, 2011 12:38 pm

Re: help on TryFindSingle

Post by sdimbre » Thu Sep 08, 2011 11:21 am

Thankyou very much for quick reply. I will try and keep you posted on this.