Page 1 of 1

Oracle Forms: Multi-Record blocks not interpreted as tables

Posted: Wed Feb 17, 2016 2:09 pm
by Arnout
I've noticed that with object identification, multi-record blocks are not interpreted as a table, even though the structure of these blocks largely resembles one. This messes up my object identification: I'd like to identify a container or cell by row and column indexes. In this example, I'd like to know if a certain row with Code column value 'x' and Omschrijving value 'y' is activated, regardless of its position in the table, to build a solid verification that doesn't fail once for any reason the order of the items in the table slightly changes. Also, I'd like to build some code to loop through rows in order to find a certain combination of values within a row and activate the appropriate checkbox.

Here's a screenshot of how this collection of containers looks like (the 'Heffing panel):
Image

Currently, Ranorex basically makes identifying a counting affair of container indexes: the text fields in the 'Code' column are counted as text-containers 1 through 24, the 'Omschrijving' column is seen as text-containers 25 through 49 or so. The checkboxes seem to have a certain technical id. I’ve placed some examples of identification in the next paragraph. This is not a suitable solution once the amount of rows exceeds the visible range of the screen, I suppose the counting of indexes will no longer work that well. Also, I don't like being dependent on validating / activating objects blindly based on their position in the grid, it will be tough maintaining these kinds of validations because the application is littered with these kinds of multi-record blocks.

This is how one of those text containers looks like in the repository: /container[@type='DrawnPanel']/text[33]

And a checkbox:
/container[@type='DrawnPanel']/container[1]/checkbox[@name='ItmChk24']

In forms builder, this is a ‘multi-record block’, which to my knowledge should translate to a table.

To summarize;
• I'd like to know if there's any way to get Ranorex to interpret the collection of containers in the 'Heffing' panel as a table.
• Once it's a table I'd like to know how to activate a checkbox/validate its state if a certain row has value 'x' for Code and 'y' for Omschrijving.
• If it's not possible to make a table out of these containers, what would be a viable alternative?

Snapshot of the container of basetype 'scrollbox' in which these elements reside included.
Ranorex version: 5.4.0.2.24580
OS: Windows 7

Thanks in advance for your time!

Re: Oracle Forms: Multi-Record blocks not interpreted as tables

Posted: Thu Feb 18, 2016 3:54 pm
by odklizec
Hi,

Could you please post a Ranorex snapshot (not screenshot) of the table in question?
Also, please let us know what Ranorex version do you use (latest is 5.4.5)?

Re: Oracle Forms: Multi-Record blocks not interpreted as tables

Posted: Thu Feb 18, 2016 4:25 pm
by Arnout
Hi odklizec, I've added the information requested to the starting post.

Re: Oracle Forms: Multi-Record blocks not interpreted as tables

Posted: Fri Feb 19, 2016 9:35 am
by odklizec
Hi,

Thanks for the snapshot. OK, two things at start... The snapshot complains about not installed/enabled Ranorex addon in IE. Please make sure it's installed/enabled. Another thing is that the latest Ranorex version is 5.4.5. Try it even in trial mode. I don't think neither will help you with recognizing given oracle (java) element as a table. But it's definitely worth a try.

I can't comment why Ranorex does not interpret such element as a table. My best guess is that it's not a typical java table and therefore, Ranorex does not recognize it as a table (it recognizes jtable perfectly fine). In other words, there is probably no special support for given oracle element, which maybe looks like a table, but it's probably not a table? ;) I would suggest to make a feature request to Ranorex (at [email protected]).

Unfortunately, the workaround to solve your problem is not going to be easy and 100% reliable. The problem is that the given 'table' element looks very automation-unfriendly. The only way how to uniquely identify the individual rows/cells and checkboxes is via childindexes. Unfortunately, this is very unstable way to identify elements.
element_childindex.png
Let's say, you want to identify the chekbox according the cell in last row/second column. The childindex of this cell is 48. So the childindex of checkbox in the same row is 24. Or better said, the childindex of container holding the checkbox is 24. So the xpath to identify chekbox based of the cell should look like this:

Code: Select all

/container[@type='FScrollBox']//text[@childIndex='48']/../Container[@type='ItmChk' and childindex='24']/checkbox
From the description of your problem, you know the text in cell, so you first need to identify the cell (based of its text), then obtain its childindex and then calculate the appropriate childindex of checkbox you want to identify. This all you will have to do in code.

You should have two xpaths in repo:
First repo element you need to obtain ChildIndex of cell holding a known text:

Code: Select all

/container[@type='FScrollBox']//text[@text=$contentOfCell]
And the other one for identifying the checkbox:

Code: Select all

/container[@type='FScrollBox']//Container[@type='ItmChk' and childindex=$childIndex]/checkbox
Then you need to fill the $contentOfCell and $childIndex variables before accessing the xpaths. Where $contentOfCell is the text in cell and $childIndex is a ChildIndex value calculated from the cell containing a known text.

To calculate the correct ChildIndex, you first need to obtain the number of table rows. This you can do using Find method, in which you should search for all 'Text' elements in DrawPanel container and then obtain the ChildIndex of last found Text element. From your snapshot it should be number 72. Now knowing there are three table columns, you can calculate 72/3 = 24. So now you know there are 24 checkboxes, 24 Heffingscode text cells and 24 Omschrijving text cells. From all this and the obtained childindex of cell with known text, you should be able to calculate the ChildIndex belonging to checkbox you want to evaluate.

Unfortunately, things will get even more complicated, if the text you will use to identify a cell is not unique. In other words, if the same 'known' text is used multiple times in multiple different cells.

As mentioned, this will not be easy, but it's definitely doable. And who knows, maybe there is even better/easier way to identify the appropriate checkbox? Good luck! ;)

Re: Oracle Forms: Multi-Record blocks not interpreted as tables

Posted: Tue Feb 23, 2016 2:50 pm
by Arnout
Hi Pavel,

Thanks for taking the time to look into this problem for me and to write a clear and elaborate reply! :) It appears the situation is indeed as bleak as I had imagined...

I'm willing to give the latest Ranorex version a try. I've got an active floating license but I found no way to get my hands on the latest version, short of downloading the trial... Shouldn't I be entitled to receive the latest versions of Ranorex for as long as my license lasts? This is a little off topic I know, but could someone point me in the right direction for a patch/standalone version of the latest Ranorex version (not the trial)?

Secondly, I'm unsure why Ranorex would complain about the IE add-on either missing or being disabled, as it is neither, as I've just checked. I've got all warnings enabled and it never tells me anything about this issue in the test run reports. Here's a screenshot of my IE add-ons:
Image

I've been thinking about this issue some more during the weekend and I was thinking of another approach that might be easier and more intuitive. I'd like to define a generic table generator class in a seperate .cs file that I can then use in the custom code section of a test.

Basically, what we see here is a container that we'd like to make into a makeshift table. This container contains some stuff that we'd like to make 'columns' out of. So what if we just feed this new class the xpath of the container in which these containers reside. If we make the following two assumptions, 1 that all 'cells' within a column all are named the same, and 2. that the first row in such a column is always the cell of said 'name' with the lowest child index. This way we sort of create an imaginary table without having to define anything ourselves. Once we use this class and feed it the xpath where the table is, it can easily determine the columns and more importantly, which cells belong to which 'row'. We might even be able to make a loop that goes through all child indexes, using the 'colum' with the child index that starts at 1, so it knows when to stop.

Once we have figured this generic part out, we can do some cool stuff with it, like, say: active a checkbox, or feed it an array of column names and their expected values that should be encountered in the same 'row'.

//activates the checkbox in any given row with column names and their required values
activateTableChk("xpathLocationOfTableContainer", "columnNameOfCheckBox", "columnName", "requiredColumnValue1", "columnName2", "expectedValue2");'

//validate the checked state of a checkbox in a given table-row
validateCheckedState("xpathLocationOfTableContainer", "columnNameOfCheckBox", "expectedCheckedState", "columnName", "requiredColumnValue1", "columnName2", "expectedValue2");

validateRow("xpathLocationOfTableContainer", "columnName", expectedValue1, "columnName", "expectedValue2");'

I'll see if I can pull this off, I think it will be possible and be relatively safe to use.

Re: Oracle Forms: Multi-Record blocks not interpreted as tables

Posted: Tue Feb 23, 2016 3:30 pm
by odklizec
Hi,

Actually, you should be able to download and use the latest Ranorex version as long as your license is valid. You can get the latest version (along with previous releases) here:
https://www.ranorex.com/free-trial/

This link is usually accessible via Start Page in Ranorex Studio...
StartPage.png
As for the problem with IE addon, I'm not quite sure about this. Maybe it's something 5.4.0 specific? If it still happens for you with 5.4.5, I would suggest to discuss it with Ranorex support folks (ideally via [email protected]).

As for the solution you come up with, it sounds interesting and exactly what you are looking for. Unfortunately, I'm not so experienced in C# so I can't be much of help here. I'm looking forward to hear more if you succeed with implementation! ;)

Re: Oracle Forms: Multi-Record blocks not interpreted as tables

Posted: Tue Feb 23, 2016 5:42 pm
by Arnout
Thanks for pointing out that it is possible to update through the start page. I did, and unfortunately it did nothing for the way Ranorex Spy views these elements. But we already suspected that. I guess I'll try to convince one of the C# guru's here to build me the code that I have in mind :)

Re: Oracle Forms: Multi-Record blocks not interpreted as tables

Posted: Tue Aug 28, 2018 2:46 pm
by Andymann
Roughly 2 years passed and it seems I am facing the same problem right now.

Is there any progress am that topic?

Re: Oracle Forms: Multi-Record blocks not interpreted as tables

Posted: Wed Aug 29, 2018 1:48 pm
by RobinHood42
Hi,

It would be great if you could explain your current issue in more detail. Since it's most likely related to the object identification, please attach a Ranorex snapshot: http://www.ranorex.com/support/how-to-c ... pshot.html

Thanks,
Robin :mrgreen:

Re: Oracle Forms: Multi-Record blocks not interpreted as tables (LOV, List of Values)

Posted: Thu Aug 30, 2018 7:59 am
by Andymann
yeah, I probably should have done that at first hand.

Good things ahead: Things got solved.
Unfortunately I am not able/ allowed to post screenshots so I have to try to describe it as best as possible.
The Situation is based around Oracle Forms' "List of values". They basically all look the same:

Image.

Problem is that neither Ranorex Spy can accesss the cells within th table nor did any search for Children, Siblings etc yield any results. The closest I came to the table was getting the ListView (the element keeping the data) with Ranorex Spy

After Messing around for some time I realized that in Spy's "Browser & Results"-View I can right click the ListView-object and have the chance to access "Dynamic Actions" (Context Menu, last entry). Found a method called "getCellData" there. And that's basically it. Sometimes it's all so easy :D

Here is my usercode to access that method:

[UserCodeMethod]
public static void countTableRows(RepoItemInfo pItem){

JavaElement item = null;
Object[] param = null;
Host.Local.TryFindSingle(pItem.AbsolutePath, 12500, out item);

(...)

param = new Object[]{0,iCounter}; //Column, Row
var returnVal = item.InvokeMethod("getCellData", param);
(...)

}

This way I am still not able to, for example, to perform a mouseclick on a cell but at least I can enumerate the table's Content.
Hope this is of any help for someone out there.

Re: Oracle Forms: Multi-Record blocks not interpreted as tables

Posted: Thu Aug 30, 2018 8:07 am
by RobinHood42
Hi,

great! Thanks for sharing your findings.

Cheers,
Robin :mrgreen: