Skip to content

Commit

Permalink
Merge pull request #350 from TestStack/HEskandari-master
Browse files Browse the repository at this point in the history
Expose Capture on IUIItem
  • Loading branch information
Roemer committed Dec 23, 2015
2 parents c7057c3 + a6d19da commit a214239
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/TestStack.White.UITests/WhiteUITestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private string TakeScreenshot(string screenshotName)
var imagePath = Path.Combine(screenshotDir, imagename);
try
{
new ScreenCapture().CaptureScreenShot().Save(imagePath, ImageFormat.Png);
Desktop.CaptureScreenshot().Save(imagePath, ImageFormat.Png);
Trace.WriteLine(String.Format("Screenshot taken: {0}", imagePath));
}
catch (Exception)
Expand Down
5 changes: 5 additions & 0 deletions src/TestStack.White/UIItems/IUIItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,10 @@ public interface IUIItem : ActionListener

void DrawHighlight();
void DrawHighlight(Color color);

/// <summary>
/// Captures an image of the element
/// </summary>
Bitmap Capture();
}
}
5 changes: 5 additions & 0 deletions src/TestStack.White/UIItems/UIItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -449,5 +449,10 @@ public virtual void DrawHighlight(Color color)
new Drawing.FrameRectangle(color, rectangle).Highlight();
}
}

public virtual Bitmap Capture()
{
return Desktop.CaptureScreenshot(Bounds);
}
}
}

0 comments on commit a214239

Please sign in to comment.