Post describing the use of a self-driving screenshot mode for apps (uses WaxSim for a CLI interface to the simulator). See also the original author's take.
UI Screen Shooter is a variant that uses UI Automation.
On the desktop, the screencapture
tool may be useful.