Bryan_N Trusted Contributor.
Trusted Contributor.
1908 views

Screen Capture using LeanFT and stdWin app

Is there a way to capture the screen image of a stdWin app like Notepad?  I can do it for browsers but can't seem to find a way for windows apps.

0 Likes
15 Replies
Micro Focus Expert
Micro Focus Expert

Re: Screen Capture using LeanFT and stdWin app

Hi Bryan,

Every test object in LeanFT has the getSnapshot method.

So if you want to get the screen shot of some StdWin app, you should describe the top level test object (either Window or Dialog) and invoke getSnapshot on it.

 

Regards,

Anton

Baurav Singh Regular Contributor.
Regular Contributor.

Re: Screen Capture using LeanFT and stdWin app

Hello,

I am Trying to get ScreeShot for sap Application but session.getSnapshot(); not working getting below Error msg java.lang.UnsupportedOperationException: The getSnapshot method is not supported for this test object.

 

Could You please provide your Code . Please Guide How to Implement this menthod fOr SAP Application.

0 Likes
Baurav Singh Regular Contributor.
Regular Contributor.

Re: Screen Capture using LeanFT and stdWin app

Hello  

Have you got resolution for your query . i also need help on this topic for SAP application or Windows Application how you have implented ScreenShot method.Please help 

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Screen Capture using LeanFT and stdWin app

Hi Baurav,

 

The SAP GuiSession test object does not support the getSnapshot method, because the session in itself is a special test object represeting the SAP execution session, rather than a concrete UI element.

Can you please try to call getSnaphot on the SAP Window test object or any other test object?

Regards,

Anton

0 Likes
Baurav Singh Regular Contributor.
Regular Contributor.

Re: Screen Capture using LeanFT and stdWin app

Hi 

I tried with SAP Window also but Window Obj don't have getSnapShot() method. Please Help on this I am struggling sence alast couple of day

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Screen Capture using LeanFT and stdWin app

Hi Baurav,

As you can see in the LeanFT documentation:

https://admhelp.microfocus.com/leanft/en/14.50/JavaSDKReference/index.html#JavaSDKReference/com/hp/lft/sdk/sap/gui/Window.html%3FTocPath%3Dcom.hp.lft.sdk.sap.gui%7CInterfaces%7C_____28

the com.hp.lft.sdk.sap.gui.Window interface inherits the getSnapshot method from the TestObject interface, so SAP GUI Window does have the getSnapshot method:

Here is a Java code template to get a snapshot of the SAP GUI Winodw (I'm assuming the folliwng import was done: import com.hp.lft.sdk.sap.gui.*;):

GuiSession guiSession = GuiSessionFactory.launch("someServer");
Window sapWindow = guiSession.describe(Window.class, new WindowDescription());
sapWindow.getSnapshot();

 

Let me know if that helps you.

 

Regards,

Anton

Baurav Singh Regular Contributor.
Regular Contributor.

Re: Screen Capture using LeanFT and stdWin app

 

Hi Anton,

I have tried with window object Now Getting Nullpointer excepetions ...I am figuring out the issue will get back to you

0 Likes
Baurav Singh Regular Contributor.
Regular Contributor.

Re: Screen Capture using LeanFT and stdWin app

Thanks Anton,

Previsouly i was doing mistake ..Thank you so much for correction.

0 Likes
Baurav Singh Regular Contributor.
Regular Contributor.

Re: Screen Capture using LeanFT and stdWin app

 

Please help i am still not able to take screenshot for SAP application.getting Nullpointer exception 

RenderedImage srcFile=window.getSnapshot(); 

File fileObj = new File(System.getProperty("user.dir")+"\\ScreenShots\\"+vendorID+"_"+".jpg");
try {
ImageIO.write(srcFile, "jpg", fileObj);
} catch (IOException e) {

e.printStackTrace();
}

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Screen Capture using LeanFT and stdWin app

Hi Baurav,

 

Could you provide the full stack of the exception?

 

Regards,

Anton

0 Likes
Baurav Singh Regular Contributor.
Regular Contributor.

Re: Screen Capture using LeanFT and stdWin app

java.lang.NullPointerException
at stepDefinitions.LeanFtStepDefinitions.user_entered_into_vendorEditField(LeanFtStepDefinitions.java:77)
at ?.Then user entered value as "8201" into vendorEditField(LeanFtFeature.feature:6)Capture.PNG

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.