Alternative in code for the Info object

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
npanag
Posts: 33
Joined: Thu Jun 02, 2016 5:42 pm

Alternative in code for the Info object

Post by npanag » Thu Mar 02, 2017 10:05 am

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

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

Re: Alternative in code for the Info object

Post by odklizec » Thu Mar 02, 2017 10:13 am

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 ;)
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

npanag
Posts: 33
Joined: Thu Jun 02, 2016 5:42 pm

Re: Alternative in code for the Info object

Post by npanag » Thu Mar 02, 2017 10:21 am

Thanks odklizec,

I'll follow your suggestion.