Page 1 of 1

Problem in identification of object in web app

Posted: Mon Nov 07, 2016 3:34 pm
by npanag
I'm working in testing a heavy web app. As you can see in the pictures uploaded, I want to catch the Div with 15,000,000 that is related to the Div 'Previous Commitment'.

The problem is that these Divs and also the TDs where they belong and the tr that is the mother of the whole branch don't have any field that i can use for the identification.

How do I solve cases like that?

Thank you

Re: Problem in identification of object in web app

Posted: Mon Nov 07, 2016 3:43 pm
by npanag
And this is the Div itself

Re: Problem in identification of object in web app

Posted: Mon Nov 07, 2016 3:47 pm
by odklizec
Hi,

Please post a Ranorex snapshot of the problematic element (learn how to create one here). Screenshots are not useful in this particular case.

Re: Problem in identification of object in web app

Posted: Mon Nov 07, 2016 3:58 pm
by npanag
Tell me something. Can I create a snapshot for only the problematic Div, or it will create a file containing the whole web application, with company data included?

The last is a big problem for me, because we are talking about sensitive corporate financial data that i must not include in the snapshot.

Re: Problem in identification of object in web app

Posted: Mon Nov 07, 2016 4:07 pm
by odklizec
Hi,

We already discussed this here:
http://www.ranorex.com/forum/object-wit ... tml#p40411
You can reduce the amount of data stored in snapshot by unchecking this option. But for your current problem, you must save at least the parent table, holding all cells visible in posted screenshot (from your first post).

Re: Problem in identification of object in web app

Posted: Mon Nov 07, 2016 4:39 pm
by npanag
I didn't check it in full detail, but i think it has bypassed the sensitive info, as per your instructions.

Re: Problem in identification of object in web app

Posted: Mon Nov 07, 2016 4:44 pm
by odklizec
Hi,

Thanks for the snapshot. I think this xpath should do return the cell you are looking for:

Code: Select all

/dom[@domain='oicem36:8080']//div[#'id_leftmargin_container']/div/table/tbody//div[@innertext='Previous Commitment']/parent::td/following-sibling::td/div

Re: Problem in identification of object in web app

Posted: Mon Nov 07, 2016 4:51 pm
by npanag
Bravo, I'm really impressed. It worked.

Where can i find info for these keywords, like parent and follow sibling and the ::?

Thanks again.

Re: Problem in identification of object in web app

Posted: Mon Nov 07, 2016 5:28 pm
by odklizec
You are welcome ;) You can learn about relationship operators and other xpaths tricks here:
http://www.ranorex.com/support/user-gui ... ditor.html

Re: Problem in identification of object in web app

Posted: Tue Nov 08, 2016 10:54 am
by npanag
OK, so I have a relationship between the item description and the first number. I also discovered the other two numbers (for example for Previous Cash Called - see picture) and I used the ajxfield property:

Previous Cash Called
--------------------------
/dom[@domain='oicem36:8080']//td[#'framescontainer']/div/div/div/table/tbody/tr/td/table/tbody/tr/td/div[@id='controls_container']/div[@id='id_controls_area']/div[@ajxname='RT_SUBSCRFUNDOPS_1']/div[@id='id_leftmargin_container']/div/table/tbody/tr/td/div[@innertext='Previous Cash Called']

Fund CCY amount
----------------------
/dom[@domain='oicem36:8080']//td[#'framescontainer']/div/div/div/table/tbody/tr/td/table/tbody/tr/td/div[@id='controls_container']/div[@id='id_controls_area']/div[@ajxname='RT_SUBSCRFUNDOPS_1']/div[@id='id_leftmargin_container']/div/table/tbody/tr/td/div[@innertext='Previous Cash Called']/parent::td/following-sibling::td/div

But the other 2 amounts are not correlated with the above (being on another clone)

/dom[@domain='oicem36:8080']//td[#'framescontainer']/div/div/div/table/tbody/tr/td/table/tbody/tr/td/div[@id='controls_container']/div

[@id='id_controls_area']/div[@ajxname='RT_SUBSCRFUNDOPS_1']/div[@id='id_client_container']/table/tbody/tr/td/div[@ajxfield='A_CASHCALLED3']

o,f=EUR
---------
/dom[@domain='oicem36:8080']//td[#'framescontainer']/div/div/div/table/tbody/tr/td/table/tbody/tr/td/div[@id='controls_container']/div

i=USD
-------
[@id='id_controls_area']/div[@ajxname='RT_SUBSCRFUNDOPS_1']/div[@id='id_client_container']/table/tbody/tr/td/div[@ajxfield='A_CASHCALLED23']

Question: Could the last 2 amounts be somehow related to the item description (Previous Cash Called)? I think no, but...

Re: Problem in identification of object in web app

Posted: Tue Nov 08, 2016 1:38 pm
by odklizec
Hi,

I don't think there is a way to refer to these two values directly by xpath. The only way I see is via a small workaround.

At first, you will have to create a new repo item, referring to "Previous Cash Called" cell, but not the cell itself, but its parent TR tag, with the xpath like this:

Code: Select all

/dom[@domain='oicem36:8080']//div[#'id_leftmargin_container']/div/table//div[@innertext='Previous Cash Called']/parent::td/parent::tr
Now you have to create a recording/coded GetValue action, which will obtain ChildIndex value of given TR tag and store it in a module variable, e.g. $varRowNumber.

Finally, you can use this variable in the xpath, which will return the values you are looking for, like this:

Code: Select all

/dom[@domain='oicem36:8080']//table[@class='class_figures_client']//tr[@childindex='3']//div[@ajxfield='A_CASHCALLED3']
and...

Code: Select all

/dom[@domain='oicem36:8080']//table[@class='class_figures_client']//tr[@childindex='3']//div[@ajxfield='A_CASHCALLED23']
Youo see, because we obtained row number from cell "Previous Cash Called", we can "easily" refer to it in the other table, holding the two remaining values ;) Hope this helps?

Re: Problem in identification of object in web app

Posted: Tue Nov 08, 2016 1:47 pm
by Vaughan.Douglas
I don't think you're going to get a direct correlation between the elements you've identified already, but you're not out of luck yet. The new element you're looking for has an "ajxfield" field that looks promising.

Code: Select all

/dom[@domain='oicem36:8080']//div[@ajxfield~'A_CASHCALLED']

Code: Select all

/dom[@domain='oicem36:8080']//div[@ajxfield~'A_CASHDISTRIBUTED']

Code: Select all

/dom[@domain='oicem36:8080']//div[@ajxfield~'A_AMOUNT']

Code: Select all

/dom[@domain='oicem36:8080']//div[@ajxfield~'A_ADJUSTEDVALUATION']
These are generic paths that will return both element per row.

Re: Problem in identification of object in web app

Posted: Tue Nov 08, 2016 2:37 pm
by npanag
Nice ideas.

I didn't realize that the tr number of related objects in both clones is the same so we can use the @childindex property.

OK, thank you very much. I predict that I'll come back with a new question very soon!!