0

.getProperty("style") outputs TestObject(Ref:RemoteProxyReference{testContext:af4e390002a336, objectId:3171, testObjectClass:TestObject})

while to[0].getProperties() outputs text hash where key "style" is presented {... , style=DISPLAY: none, oncontrolselect=null Object, rowSpan=1, .....}

How can I get the value of the property with key style?

here's sample of my code ...

TestObject[] to=null;
RegularExpression findRegExp1 = new RegularExpression(find_arguments[1], false) ;
RootTestObject root = getRootTestObject();
to = root.find(atDescendant(find_arguments[0],findRegExp1),false);

System.out.println(to[0].getProperty("style"));
System.out.println( to[0].getProperties()); 

Both methods are standard RFT methods. More info at IBM Rational Functional Tester API Reference

Radek
  • 13,813
  • 52
  • 161
  • 255
  • It appears from your code sample that `getProperty()` is a custom method of whatever type is returned by `root.find(...)`. Without the code for _at least_ `getProperty()`, nobody will be able to help you. – Jim Garrison May 08 '12 at 05:55
  • @Jim: updated my question. Both methods are standard RFT methods. I cannot event see values of getProperty("style") when debugging. – Radek May 08 '12 at 06:16

3 Answers3

1
System.out.println(to[0].getProperty("style"));

This invokes toString() on the value of to[0].getProperty(). The object being returned by getProperty() likely has methods to retrieve various attributes, such as the text value, but produces the output you see for a simple toString().

You are going to have to research this in the RFT documentation to determine which method provides the data you want.

Jim Garrison
  • 85,615
  • 20
  • 155
  • 190
  • `Returns the value of the specified property. If the property type is not a value class, getProperty registers the object in the software under test and returns a reference to the object. Registered object references are released by calling one of the unregister methods. ` hmm. How can I access the object getProperty("style") created? – Radek May 08 '12 at 06:26
  • You will have to figure out the type of the object. You haven't shown the declaration of `to` in your code. – Jim Garrison May 08 '12 at 06:28
  • The declaration is `TestObject[] to=null;` . How can I figure out? – Radek May 08 '12 at 06:32
  • What are the methods on `TestObject`? – Jim Garrison May 08 '12 at 08:21
  • http://publib.boulder.ibm.com/infocenter/rfthelp/v7r0m0/index.jsp?topic=/com.rational.test.ft.api.help/ApiReference/com/rational/test/ft/object/interfaces/TestObject.html – Radek May 08 '12 at 22:54
1

I think "stlye" is a Non-Value property. As the documentation states: http://publib.boulder.ibm.com/infocenter/rfthelp/v7r0m0/index.jsp?topic=/com.rational.test.ft.api.help/ApiReference/com/rational/test/ft/object/interfaces/TestObject.html

You can find the non-value properties by calling getNonValueProperties(). You can use the getProperty method to access both value and non-value properties. If you access a non-value property, the property returns a TestObject that contains a reference to the (non-value) object in the software under test.

you cannot access the content of that property.

Open up the Test Object Inspector and look if "style" is in the Non-Value Properties panelNon Value properties in the Test Object Inspector

I just tried with IE6 on a page and cannot read the "style" property.

Alessandro Da Rugna
  • 4,571
  • 20
  • 40
  • 64
1

I opened a ticket with IBM support and this is the final answer:

"I have done the test in your website and confirmed the getProperty("style") output. It was a bug and has been fixed in RFT8.2.1.1. I confirmed that the getProperty method in RFT 8.2.1.1 works well."

Radek
  • 13,813
  • 52
  • 161
  • 255