Get cursor type for a WPF application in RFT

264 views Asked by At

I want to determine if my WPF application UI is ready for interaction. When I inspect properties of my WpfTopLevelSubitemTestObject, I can see a property called "Cursor" of type TestObject.

However, I couldn't find a way to get cursor type or state from this "Cursor" property. Its properties are not accessible (getProperties throws a WrappedException); non-value properties are empty; it has a "get_CursorType" method which returns another TestObject, which is also useless.

Any ideas?

1

There are 1 answers

0
Prakash On BEST ANSWER

RFT supports WPF applications and here is how you could get the cursor property( of a WPF text box recorded in RFT as textBox1text2() )

    TestObject t = (TestObject) textBox1text2().getProperty("Cursor");
   System.out.println("Cursor Property: " +  t.invoke("ToString"));

The property "Cursor" actually is of type System.Windows.Input.Cursor for which there is no value manager. For a sample application where I have set the text box to have Cursor as "Pen" if I run the above code I would get the ouput as :

    Cursor Property: Pen

If no cursor is set then you would most likely get the cursor property as NULL so it can add a NULL check before invoking ToString . If you want to find out what is the actual type of object that the TestObject "t" is referring to you could also do this:

System.out.println("Actual Object type: "+ t.getObjectClassName() +". And Cursor: " +  t.invoke("ToString"));

and output would be:

 Actual Object type: System.Windows.Input.Cursor. And Cursor: Pen

Hope it helps.