Hi,
The application under test have a table in the application and its row contains value by default.
Based on various parameters, the column contains different values. In one of the cell value , it returns an array of objects.
When I try to retrieve "Text" property of these cells I always get "[Lcom.ambientcorp.nms.common.type.ID;@65031a" values.
The cell value is an array of class instances and this returns a value indicating that an array is returned [Lcom.ambientcorp.nms.common.type.ID;@65031a
When a Java array comes back how do Ranorex access the elements of the array?
Regards,
Pramila
How do Ranorex access the elements of the array in Java?
Re: How do Ranorex access the elements of the array in Java?
Hi,
Could you please post a Ranorex snapshot (or send it to [email protected]) of the table/element in question?
Also, what exactly do you want to do with the obtained "array"? Validate just one (or more) of its values?
It should be possible to obtain specific elements of that "array" by using GetValue action combined with carefully constructed regular expression. Check this user guide paragraph...
http://www.ranorex.com/support/user-gui ... html#c4090
Another possibility might be to use a custom code to parse the array and do whatever you want with the individual array elements.
Could you please post a Ranorex snapshot (or send it to [email protected]) of the table/element in question?
Also, what exactly do you want to do with the obtained "array"? Validate just one (or more) of its values?
It should be possible to obtain specific elements of that "array" by using GetValue action combined with carefully constructed regular expression. Check this user guide paragraph...
http://www.ranorex.com/support/user-gui ... html#c4090
Another possibility might be to use a custom code to parse the array and do whatever you want with the individual array elements.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: How do Ranorex access the elements of the array in Java?
My primary SUT is a Java POS application. I have similar issues.
The problem isn't that an array is returned. The problem is that a STRING REPRESENTATION of the ARRAY POINTER is returned. This is typical with a Java table in Swing. If you developers don't set up the cell renderer the right way, Ranorex won't be able to see the actual value. Note: When I say "right way" here I don't mean that the devs did anything wrong with the way they did it, just that Java renders table cells strangely if the developer doesn't change it.
You will probably need to have your developers change the table to include the needed information if you want to get the actual values from inside the array.
The problem isn't that an array is returned. The problem is that a STRING REPRESENTATION of the ARRAY POINTER is returned. This is typical with a Java table in Swing. If you developers don't set up the cell renderer the right way, Ranorex won't be able to see the actual value. Note: When I say "right way" here I don't mean that the devs did anything wrong with the way they did it, just that Java renders table cells strangely if the developer doesn't change it.
You will probably need to have your developers change the table to include the needed information if you want to get the actual values from inside the array.
Shortcuts usually aren't...
Re: How do Ranorex access the elements of the array in Java?
please find the Ranorex snapshot of the table/element in question.
Thanks for the response.
Thanks for the response.
You do not have the required permissions to view the files attached to this post.
Re: How do Ranorex access the elements of the array in Java?
Yeah, after looking at the snapshot, it's as I said, Ranorex is reading the array pointer instead of the array items. Your developers implemented the renderer to display the array as a comma separated list, which means Ranorex can't see the actual string text because it only sees the cell and not the renderer. You will need to have the developers change the cell to include the string in an attribute or something similar.
Shortcuts usually aren't...