Skip to main content



      Home
Home » Archived » Jubula » How to get a particular text from a Swing application using Jubula's Java API(Java Getter to get a text value from a Swing Application using Jubula)
How to get a particular text from a Swing application using Jubula's Java API [message #1809252] Fri, 12 July 2019 08:00 Go to next message
Eclipse UserFriend
I am using Jubula 8.7.1 and Java 8. I have used the Java API to automate a few actions in a Swing application.

I have some text that I want to catch in a may be a String object from the app. Is there any way I can do that. I have used 'TextComponent' to identify the region in the app. But 'TextComponent' does not have any getter method that return a String.

  • Attachment: Capture.PNG
    (Size: 3.39KB, Downloaded 235 times)
Re: How to get a particular text from a Swing application using Jubula's Java API [message #1809433 is a reply to message #1809252] Tue, 16 July 2019 03:12 Go to previous messageGo to next message
Eclipse UserFriend
There are two possibilities:
The first one is to use readValue:
Result readValue = text.readValue();
String text = readValue.getReturnValue();

The second one is to find the correct property name an us getPropertyValue:
Result propertyValue = text.getPropertyValue("text");
String text = propertyValue.getReturnValue();

best regards
Marvin Mueller
Re: How to get a particular text from a Swing application using Jubula's Java API [message #1810282 is a reply to message #1809433] Tue, 06 August 2019 09:19 Go to previous messageGo to next message
Eclipse UserFriend
Thank you Marvin! This helps
Re: How to get a particular text from a Swing application using Jubula's Java API [message #1831925 is a reply to message #1809433] Thu, 03 September 2020 02:59 Go to previous messageGo to next message
Eclipse UserFriend
Hi Marvin,

From which class Result needs to be imported ??

Result readValue= filesize.readValue();
String text=readValue.getReturnValue();

I am getting error for add cast to Result when I am importing Result from org.eclipse.jubula.client.Result;

also when I add the type cast to Result class
Result readValue= (Result) filesize.readValue();

then I get ClassCast Exception


java.lang.ClassCastException: org.eclipse.jubula.communication.internal.message.MessageCap cannot be cast to org.eclipse.jubula.client.Result


Any help will be highly appreciated.

Thanks,
Nidhi





Re: How to get a particular text from a Swing application using Jubula's Java API [message #1832145 is a reply to message #1831925] Thu, 10 September 2020 03:13 Go to previous message
Eclipse UserFriend
If you are having the MessageCap you did not have executed tha action.
You must execute the action first. Or you can use the ActionHandler, they are executing the action directly and than you can use the example above.

best regards
Marvin Mueller
Previous Topic:External Command Ubuntu
Next Topic:Test result
Goto Forum:
  


Current Time: Mon May 12 15:43:28 EDT 2025

Powered by FUDForum. Page generated in 0.03621 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top