screenshot

How do I take a screenshot when a test in internjs fails?

安稳与你 提交于 2020-01-13 07:11:28
问题 I am having issues figuring out how to take a screenshot ONLY when a test fails in InternJs. I have this simple test in my registerSuite; 'verify google homepage': function () { var url = 'https://www.google.com/'; return this.remote .get(url) .getCurrentUrl() .then(function (data) { assert.strictEqual(data, url, 'Incorrect URL'); }) .findByName('q') .click() } I can simply create a screenshot using the following code; .takeScreenshot .then(function (data) { fs.writeFileSync('/path/to/some

How do I take a screenshot when a test in internjs fails?

◇◆丶佛笑我妖孽 提交于 2020-01-13 07:11:12
问题 I am having issues figuring out how to take a screenshot ONLY when a test fails in InternJs. I have this simple test in my registerSuite; 'verify google homepage': function () { var url = 'https://www.google.com/'; return this.remote .get(url) .getCurrentUrl() .then(function (data) { assert.strictEqual(data, url, 'Incorrect URL'); }) .findByName('q') .click() } I can simply create a screenshot using the following code; .takeScreenshot .then(function (data) { fs.writeFileSync('/path/to/some

Taking screenshot from a python script by selecting the area

我与影子孤独终老i 提交于 2020-01-12 11:06:34
问题 I saw that post (that is really helpful : Take a screenshot via a python script. [Linux]) about taking a screenshot from python. It works well but I'd like to have the same behavior as gnome-screenshot : having the possibility to choose between : Capturing the whole desktop Capturing an active window Capturing an area Is there a way to do this in python, or, eventually, to use the gnome-screenshot application to do it, and then getting the file ? I tried to find the perfect command line for

Taking screenshot from a python script by selecting the area

为君一笑 提交于 2020-01-12 11:04:55
问题 I saw that post (that is really helpful : Take a screenshot via a python script. [Linux]) about taking a screenshot from python. It works well but I'd like to have the same behavior as gnome-screenshot : having the possibility to choose between : Capturing the whole desktop Capturing an active window Capturing an area Is there a way to do this in python, or, eventually, to use the gnome-screenshot application to do it, and then getting the file ? I tried to find the perfect command line for

Capturing Screen

纵然是瞬间 提交于 2020-01-12 07:47:05
问题 I am trying to capture (screen shot) a view. For that I am using a piece of code shown below that saves it to my document directory as a PNG image. UIGraphicsBeginImageContextWithOptions(highlightViewController.fhView.centerView.frame.size, YES, 1.0); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext(); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString

Capturing a window with WPF

馋奶兔 提交于 2020-01-12 05:54:14
问题 With Windows Presentation Foundation, if I have an HWND, how can I capture it's window as an image that I can manipulate and display? 回答1: You can: CreateBitmap() to create a hBitmap Call GetDC() on the hWnd BitBlt() the contents to the hBitmap ReleaseDC() Call Imaging.CreateBitmapSourceFromHBitmap() to create a managed BitmapSource DeleteObject() on the hBitmap Use the BitmapSource as desired Steps 1-4 and 6 use the Win32 API (GDI to be precise), Steps 5 and 7 are done using WPF 回答2: While

How to correctly screencapture a specific window on Aero/DWM

倖福魔咒の 提交于 2020-01-11 20:05:50
问题 Background info: I have this MFC application I coded and been using for a long time that pretty much automatically saves screenshots to the hard disk when the user hits the Print Screen/Alt+Print Screen key. I have been putting off using anything related to Aero until now that I've been using Windows 7 RC for a couple of weeks. The problem: I'm using the standard GetDC/BitBlt method to capture the window contents. I have no problems with this method while doing regular full-screen grabs (no

How to correctly screencapture a specific window on Aero/DWM

喜你入骨 提交于 2020-01-11 20:03:32
问题 Background info: I have this MFC application I coded and been using for a long time that pretty much automatically saves screenshots to the hard disk when the user hits the Print Screen/Alt+Print Screen key. I have been putting off using anything related to Aero until now that I've been using Windows 7 RC for a couple of weeks. The problem: I'm using the standard GetDC/BitBlt method to capture the window contents. I have no problems with this method while doing regular full-screen grabs (no

How to take a screenshot when a webview finished rending

最后都变了- 提交于 2020-01-11 13:29:07
问题 I want to take a screenshot when a webview finished rending.The follow is my code: -(void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { if (frame != [sender mainFrame]) { return; } NSBitmapImageRep *rep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:[sender bounds]] autorelease]; if (rep){ NSImage *img = [[NSImage alloc] initWithData:[rep TIFFRepresentation]]; NSData* imgData = [img TIFFRepresentation]; NSArray* deskTopArrayPaths =

Share Image on Android Application from Unity Game

不打扰是莪最后的温柔 提交于 2020-01-11 12:06:53
问题 I've captured screenshot in my game when player dies. I've following code to capture screen shot. RenderTexture rt = new RenderTexture (800, 600, 24); MainCamera.targetTexture = rt; Texture2D texture = new Texture2D (800, 600, TextureFormat.RGB24, false); MainCamera.Render (); RenderTexture.active = rt; texture.ReadPixels (new Rect (0, 0, 800, 600), 0, 0); MainCamera.targetTexture = null; RenderTexture.active = null; Destroy (rt); byte[] bytes = texture.EncodeToPNG (); Directory