Page 1 of 1

Alternative in code for the Info object

Posted: Thu Mar 02, 2017 10:05 am
by npanag
Hi guys,

I try to construct in code an alternative of the Info object that is created automatically in repo.
For example, with the usage of repo we have this easy way if an object exists:

if (repo.MyApplication.MyButtonInfo.Exists(5000)) {
//do stuff
}

If we want this with code?
I have the following button :

/dom[@domain='ServerName:Port']//td[#'framescontainer']/div[@visible='True']/div/div/table/tbody/tr/td/table/tbody/tr/td/div[#controls_container]/div[@id='id_controls_area']/div[@ajxname='Section_3']/table[@ajxname='OPERATIONS_2']/tbody/tr/td[#id_setof_content]/table/tbody/tr/td/span[#id_next]

If I have one page with operations, this button doesn't exist. If I have multiple pages of operations this button exists. If I declare it in the repository, then it's easy to use the Info object.

I wonder how to do this without the repository, because I don't want to be dependent on many objects in the repository.

Thank you

Re: Alternative in code for the Info object

Posted: Thu Mar 02, 2017 10:13 am
by odklizec
Hi,

I'm afraid, the Ranorex Info object cannot be created from code. You will have to use the repo to be able to use Info object.

In my opinion, not using repo is a wrong idea. You see, the Ranorex repo is a central place where you can store and manage all GUI elements. If properly used, it's the best place for element maintenance. Once you start using xpaths in code, you may end up with very messy and hard to maintain solution ;)

Re: Alternative in code for the Info object

Posted: Thu Mar 02, 2017 10:21 am
by npanag
Thanks odklizec,

I'll follow your suggestion.