Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 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 12:00 Go to next message
rupayan nath is currently offline rupayan nathFriend
Messages: 8
Registered: July 2019
Junior Member
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 144 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 07:12 Go to previous messageGo to next message
Marvin Mueller is currently offline Marvin MuellerFriend
Messages: 241
Registered: March 2012
Senior Member
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 13:19 Go to previous messageGo to next message
rupayan nath is currently offline rupayan nathFriend
Messages: 8
Registered: July 2019
Junior Member
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 06:59 Go to previous messageGo to next message
Nidhi Kashyap is currently offline Nidhi KashyapFriend
Messages: 21
Registered: August 2020
Junior Member
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 07:13 Go to previous message
Marvin Mueller is currently offline Marvin MuellerFriend
Messages: 241
Registered: March 2012
Senior Member
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: Thu Jun 24 23:17:16 GMT 2021

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

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

Back to the top