Tip to identify web object by ID + other tag

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Florian
Posts: 75
Joined: Fri Jul 27, 2012 12:57 pm
Location: France (Lyon)
Contact:

Tip to identify web object by ID + other tag

Post by Florian » Wed Oct 15, 2014 8:32 am

Hi all,

I've just think about a tip I could give you, just in case.
In my test suite, I am looking for the following aTag:

Code: Select all

.//a[@id='ctl00_ctl00_cphMainContent_cphMainContent_DetailCommand_lbClose' and @visible='true']
With a previous release of Ranorex, it was quite fast. But now with the 5.1.3 it could take 20-30 seconds to find the web object.

You may wonder: "why the hell he use such a path?!"
It is due to ajax code, when I click a button on the website and waiting for an object to exist (maybe there is a better way to do it?)

Not to wait 20-30s, I think how I could change the code. Finally I realized I could change the path like that:

Code: Select all

.//a[#'ctl00_ctl00_cphMainContent_cphMainContent_DetailCommand_lbClose']/../a[@visible='true']
In that way, he find easily the aTag but he is still waiting for the 'visible' option to be true.

What do you think?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Tip to identify web object by ID + other tag

Post by Support Team » Thu Oct 16, 2014 2:27 pm

Hi Florian,

When you want to use other attributes beside the unique id too you need to use the following expression:

Code: Select all

.//a[#'ctl00_ctl00_cphMainContent_cphMainContent_DetailCommand_lbClose'][@visible='true']
for more information please see: RanoreXPath.

Regards,
Markus

Florian
Posts: 75
Joined: Fri Jul 27, 2012 12:57 pm
Location: France (Lyon)
Contact:

Re: Tip to identify web object by ID + other tag

Post by Florian » Thu Oct 16, 2014 2:29 pm

Oh thank you very much! It is obviously easier ...
Ok, forget what I wrote last time :)