curious Java object recognition for javax.swing.JLabel (419 Views)
Reply
Advisor
pavel75
Posts: 17
Registered: ‎10-08-2013
Message 1 of 5 (419 Views)

curious Java object recognition for javax.swing.JLabel

Hi all,

 

a GUI element which is an instance of javax.swing.JLabel is handled in two different ways using Object Spy and during runtime object recognition.

  1. when the label has text, it is recognized as JavaStaticText
  2. when the label has no text, it is recognized as JavaObject (surprised too?)

If only JavaStaticText repository object is created, it will not be recognized on runtime, when the label gets no text.

If only JavaObject repository object is created, it will not be recognized on runtime, when the label gets a text.

 

Do I always have to create 2 repository objects (1x JavaObject and 1x JavaStaticText) for each JLabel and make an existence test in VBScript  for both objects to use the right one on runtime?

 

Or is it possible to configure "Object identification" in such way, that the JLabel is always recognized as JavaStaticText regardless it has text or has no text?

 

I have no possibility to implement readOnly textbox instead ;-)

 

Thanx for your comments,

Pavel

 

Please use plain text.
HP Expert
Ana_Noncheva
Posts: 245
Registered: ‎08-06-2013
Message 2 of 5 (358 Views)

Re: curious Java object recognition for javax.swing.JLabel

Hi,

 

Yes, you can modify the object recognizion properties as explained if following article: http://support.openview.hp.com/selfsolve/document/KM194592

Another workaround is to use variable with description of this object to work with it without learning it in OR. Details for this you can find in HP Unified Functional Testing User Guide > GUI Testing Design > Programming in GUI Testing Documents in the Editor > Programmatic Descriptions > Dynamic Programmatic Descriptions. In you case you will need to find your object with ChildObjects method (HP Unified Functional Testing User Guide > GUI Testing Design > Programming in GUI Testing Documents in the Editor > Programmatic Descriptions > Retrieving Child Objects).

 

Regards,

Ana

“HP Support
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.”
Please use plain text.
Advisor
pavel75
Posts: 17
Registered: ‎10-08-2013
Message 3 of 5 (345 Views)

Re: curious Java object recognition for javax.swing.JLabel

Does ot mean when I define new object identification property for JavaStaticText, which is not empty for JLabel with empty label, this JLabel will always be recognized as JavaStaticText?

Thank you very much.

Pavel

Please use plain text.
HP Expert
Ana_Noncheva
Posts: 245
Registered: ‎08-06-2013
Message 4 of 5 (330 Views)

Re: curious Java object recognition for javax.swing.JLabel

Hi,

 

I am not sure I understand your question.

Can you check and share the toolkit class & classpath property values of the JavaStaticText & JavaObject?

 

Also, what operation do you need to perform on them?

I think you can only use the JavaObject one with the help of its attached text/text properties (which should be the same as the ones of the JavaStaticText, when there is actually the corresponding label present in your AUT).

 

Regards,

Ana

“HP Support
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.”
Please use plain text.
Advisor
pavel75
Posts: 17
Registered: ‎10-08-2013
Message 5 of 5 (323 Views)

Re: curious Java object recognition for javax.swing.JLabel

Hi,

 

I perform custom Click operations on JavaObject and JavaStaticText.

Here is the comparison of props from Object spy.

object_vs_static.png

When I use only JavaObject, then the Label with text is not recognized.

 

Regards,

Pavel

 

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation