Automatically taking screenshots of program window
Asked Answered
D

7

22

I'm looking for a software that combines macro recording with screenshot taking capabilities.

We have a software manual with a number of screenshots. When new version of software is released we need to update most of screenshots and we have to do it manually. Now we started translating manual to several languages and number of screenshots to take have increased ten fold. We'd like to automate this process.

There will be a recorded macro or something that clicks button within our software and takes screenshots of the program window. Better yet, we can specify the name of each screenshot individually though it's less important.

Does such a thing exist?

Dumyat answered 20/1, 2011 at 19:41 Comment(1)
I advice you to target Microsoft UI Automation API in this specific scenario, since you have full source codes and suppport of the appication lifecycle in your organization. You need to record the UI scripts, using custom automation provider, capable to record and playbacks UI automations, then you can add your custom behavior like screen shots, since automation api has 3 ways to assess UI programmatically: by AutomationId property, by using screen points (mouse clicks), and visual tree item (UI traversal).Appreciable
E
6

I use AutoIt plus captdll.dll for all my Windows GUI automation tasks.

Example:

Run("Notepad.exe", @WindowsDir, @SW_MAXIMIZE)   ; Open NOTEPAD
Sleep(1000)
Send("Just a Test")   ; Send some text to notepad

; Save the screen to test.jpg  
$anPos = WinGetClientSize("")
$nLeft = 0
$nTop = 0
$nRight = $anPos[0]
$nBottom = $anPos[1]

$sFileName = "test.jpg"
DllCall("captdll.dll", "int:cdecl", "CaptureScreen", "str", $sFileName, "int", 85)

This way you can automate the entire screenshot capturing process:

  • start your application with Run
  • select each of your menu options with Send
  • complete each screen's data also with Send
  • capture with DllCall("captdll.dll" ....)

You can also add conditional logic, loop, etc.

Enrichetta answered 31/1, 2011 at 15:24 Comment(0)
S
2

Yes. You want automated testing software, which can do all this and test your product too.

http://en.wikipedia.org/wiki/List_of_GUI_testing_tools

Sharper answered 24/1, 2011 at 16:46 Comment(3)
A lot depends on what tools you are used to. Tools exist which can be programmed in everything from Perl, Java, C#, VB and JavaScript to Ruby. Consider AutoIt for example, as in this question: #371173Sharper
Ben, I'm aware of GUI testing tools. My question is not about testing though it comes close. The question is which software can walk through the Windows software and take screenshots of the program window.Dumyat
@Sergey Kornilov: Look into Windows Automation APIAppreciable
R
2

Testing Anywhere seems to have the functionality you need. Some words from their website:

"Powerful GUI based recording capabilities and a no-programming required user interface allows testers to quickly set up even complex test cases" ...

"Visual log reports: Testing Anywhere’s powerful Visualize option takes screenshots to create visual logs during runtime." (see here)

You could also try something more simple and (cheaper!) such as Jitbit Macro Recorder that let's you play back recorded macro's (keyboard and mouse) and then use the Shift-PrintScreen key in the macro to make screenshots. It also has a macro script editor.

Richman answered 29/1, 2011 at 13:8 Comment(0)
T
2

If it's a webapp you can use Selenium. There is a similar tools for Visual Studio's called Test Automation FX

Tedmund answered 30/1, 2011 at 18:46 Comment(0)
A
2

Yoiu can look into existing Windows Automation API : UI Automation, MSDN documentation

Run-Time Requirements

UI Automation is supported on the following operating systems: Windows XP, Windows Server 2003, Windows Server 2003 R2, Windows Vista, Windows 7, Windows Server 2008, and Windows Server 2008 R2.

Client applications, from simple test scripts to robust record and playback utilities, may require access to elements that are not currently instantiated, such as a file open dialog or a menu item and therefore do not exist in the UI Automation tree. These elements can only be instantiated by reproducing, or "playing back", a specific sequence of user interface (UI) actions through the use of UI Automation properties such as AutomationID, control patterns and event listeners. See Test Script Generator Sample for an example that uses Microsoft UI Automation to generate test scripts based on user interaction with the user interface (UI).

You can use AutomationIdProperty inside existing Visual Studio project.

Implementing UI Automation in a Test Application

  • Add the UI Automation References.

The UI Automation dll's necessary for UI Automation clients are listed here.

UIAutomationClient.dll provides access to the UI Automation client-side APIs.

UIAutomationClientSideProvider.dll provides the ability to automate Win32 controls. See UI Automation Support for Standard Controls.

UIAutomationTypes.dll provides access to the specific types defined in UI Automation.

  • Add the System.Windows.Automation namespace.

This namespace contains everything UI Automation clients need to use the capabilities of UI Automation except text handling.

  • Add the System.Windows.Automation.Text namespace.

This namespace contains everything a UI Automation clients need to use the capabilities of UI Automation text handling.

  • Find controls of interest

Automated test scripts locate UI Automation elements that represent controls of interest within the automation tree.

There are multiple ways to obtain UI Automation elements with code.

Query the UI using a Condition statement. This is typically where the language-neutral AutomationIdProperty is used. Note An AutomationIdProperty can be obtained using a tool such as UISpy.exe (UI Spy) that is able to itemize the UI Automation properties of a control.

Use the TreeWalker class to traverse the entire UI Automation tree or a subset thereof.

Track focus.

Use the hWnd of the control.

Use screen location, such as the location of the mouse cursor.

See Obtaining UI Automation Elements

  • Obtain Control Patterns

Control patterns expose common behaviors for functionally similar controls.

After locating the controls that require testing, automated test scripts obtain the control patterns of interest from those UI Automation elements. For example, the InvokePattern control pattern for typical button functionality or the WindowPattern control pattern for window functionality.

See UI Automation Control Patterns Overview.

  • Automate the UI

Automated test scripts can now control any UI of interest from a UI framework using the information and functionality exposed by the UI Automation control patterns.

Related Tools and Technologies

There are a number of related tools and technologies that support automated testing with UI Automation.

UISpy.exe (UI Spy) is a graphical user interface (GUI) application that can be used to gather UI Automation information for both provider and client development and debugging. UI Spy is included in the Windows Software Development Kit (SDK).

UIAutoCmd is a command-line tool with capabilities similar to UI Spy.

MSAABridge exposes UI Automation information to Active Accessibility clients. The primary goal of bridging UI Automation to Active Accessibility is to allow existing Active Accessibility clients the ability to interact with any framework that has implemented UI Automation. Security

For security information, see UI Automation Security Overview.

Appreciable answered 31/1, 2011 at 6:55 Comment(0)
F
2

I've tried many and the one that really stands out, in my opinion, is Adobe (formerly Macromedia) Captivate. It's atrociously expensive (~800$) but worth every penny.

Creating tutorials etc. takes minutes instead of hours.

Filip answered 31/1, 2011 at 10:19 Comment(0)
T
0

I would use the Open Source tool Sikuli. Pretty straight forward scripting language or you can use their classes and write your own java code.

Here is the documentation to grab a part of the screen: http://sikuli.org/docx/screen.html#capturing

The bonus is that this is supported on Windows, Linux and Mac!

Tarpaulin answered 31/1, 2011 at 15:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.