{"action":"created","issue":{"url":"https://api.github.com/repos/DevExpress/testcafe/issues/1625","repository_url":"https://api.github.com/repos/DevExpress/testcafe","labels_url":"https://api.github.com/repos/DevExpress/testcafe/issues/1625/labels{/name}","comments_url":"https://api.github.com/repos/DevExpress/testcafe/issues/1625/comments","events_url":"https://api.github.com/repos/DevExpress/testcafe/issues/1625/events","html_url":"https://github.com/DevExpress/testcafe/issues/1625","id":243743997,"number":1625,"title":"Screenshot on teamcity agent fails with error","user":{"login":"satispunk","id":16405686,"avatar_url":"https://avatars1.githubusercontent.com/u/16405686?v=4","gravatar_id":"","url":"https://api.github.com/users/satispunk","html_url":"https://github.com/satispunk","followers_url":"https://api.github.com/users/satispunk/followers","following_url":"https://api.github.com/users/satispunk/following{/other_user}","gists_url":"https://api.github.com/users/satispunk/gists{/gist_id}","starred_url":"https://api.github.com/users/satispunk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/satispunk/subscriptions","organizations_url":"https://api.github.com/users/satispunk/orgs","repos_url":"https://api.github.com/users/satispunk/repos","events_url":"https://api.github.com/users/satispunk/events{/privacy}","received_events_url":"https://api.github.com/users/satispunk/received_events","type":"User","site_admin":false},"labels":[{"id":243973471,"url":"https://api.github.com/repos/DevExpress/testcafe/labels/SYSTEM:%20browser%20natives","name":"SYSTEM: browser natives","color":"bfe5bf","default":false},{"id":201866359,"url":"https://api.github.com/repos/DevExpress/testcafe/labels/TYPE:%20bug","name":"TYPE: bug","color":"f7c6c7","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/DevExpress/testcafe/milestones/23","html_url":"https://github.com/DevExpress/testcafe/milestone/23","labels_url":"https://api.github.com/repos/DevExpress/testcafe/milestones/23/labels","id":2655761,"number":23,"title":"Sprint #9","description":"","creator":{"login":"AlexanderMoskovkin","id":12047804,"avatar_url":"https://avatars0.githubusercontent.com/u/12047804?v=4","gravatar_id":"","url":"https://api.github.com/users/AlexanderMoskovkin","html_url":"https://github.com/AlexanderMoskovkin","followers_url":"https://api.github.com/users/AlexanderMoskovkin/followers","following_url":"https://api.github.com/users/AlexanderMoskovkin/following{/other_user}","gists_url":"https://api.github.com/users/AlexanderMoskovkin/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexanderMoskovkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexanderMoskovkin/subscriptions","organizations_url":"https://api.github.com/users/AlexanderMoskovkin/orgs","repos_url":"https://api.github.com/users/AlexanderMoskovkin/repos","events_url":"https://api.github.com/users/AlexanderMoskovkin/events{/privacy}","received_events_url":"https://api.github.com/users/AlexanderMoskovkin/received_events","type":"User","site_admin":false},"open_issues":23,"closed_issues":17,"state":"open","created_at":"2017-07-22T11:56:24Z","updated_at":"2017-09-08T16:57:45Z","due_on":"2017-09-14T07:00:00Z","closed_at":null},"comments":3,"created_at":"2017-07-18T14:50:50Z","updated_at":"2017-09-10T16:01:35Z","closed_at":"2017-08-31T11:15:02Z","author_association":"NONE","body":"### Are you requesting a feature or reporting a bug?\r\n\r\nBug\r\n\r\n### What is the current behavior?\r\n\r\nt.takeScreenshot fails in a background.\r\n\r\n```\r\nWas unable to take a screenshot due to an error.|n|nCommand failed: E:\\BuildAgent\\work\\8a3cefc0dd10ecd5\\node_modules\\testcafe-browser-tools\\bin\\win\\screenshot.exe 3539314 firefox E:\\BuildAgent\\work\\8a3cefc0dd10ecd5\\test\\testcafe\\reports\\screenshots\\2017-07-18_04-17-21\\test-1\\Firefox_45.0.0_Windows_8.1_0.0.0\\1.png|n|nUnhandled Exception: System.ComponentModel.Win32Exception: The handle is invalid|r|n   at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)|r|n   at System.Drawing.Graphics.CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation)|r|n   at BrowserTools.Screenshot.CaptureFromScreen(IntPtr hwnd, WindowInfo wi)|r|n   at BrowserTools.Screenshot.CaptureWindow(IntPtr hwnd, String processName)|r|n   at BrowserTools.Screenshot.Main(String|[|] args)|n|n\t\tWas unable to take a screenshot due to an error.|n|nCommand failed: E:\\BuildAgent\\work\\8a3cefc0dd10ecd5\\node_modules\\testcafe-browser-tools\\bin\\win\\screenshot.exe 7602576 chrome E:\\BuildAgent\\work\\8a3cefc0dd10ecd5\\test\\testcafe\\reports\\screenshots\\2017-07-18_04-17-21\\test-1\\Chrome_59.0.3071_Windows_8.1_0.0.0\\1.png|n|nUnhandled Exception: System.ComponentModel.Win32Exception: The handle is invalid|r|n   at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)|r|n   at System.Drawing.Graphics.CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation)|r|n   at BrowserTools.Screenshot.CaptureFromScreen(IntPtr hwnd, WindowInfo wi)|r|n   at BrowserTools.Screenshot.CaptureWindow(IntPtr hwnd, String processName)|r|n   at BrowserTools.Screenshot.Main(String|[|] args)|n\r\n```\r\n\r\n### What is the expected behavior?\r\n\r\nScreenshot is taken successfully\r\n\r\n### How would you reproduce the current behavior (if this is a bug)?\r\n\r\nRun test on TC agent\r\n\r\n#### Provide the test code and the tested page URL (if applicable)\r\n\r\nTest code\r\n\r\n```js\r\nawait t.takeScreenshot()\r\n```\r\n\r\n### Specify your\r\n\r\n* operating system: Windows 8.1\r\n* testcafe version: 0.16\r\n* node.js version: 6.6.0"},"comment":{"url":"https://api.github.com/repos/DevExpress/testcafe/issues/comments/328352156","html_url":"https://github.com/DevExpress/testcafe/issues/1625#issuecomment-328352156","issue_url":"https://api.github.com/repos/DevExpress/testcafe/issues/1625","id":328352156,"user":{"login":"satispunk","id":16405686,"avatar_url":"https://avatars1.githubusercontent.com/u/16405686?v=4","gravatar_id":"","url":"https://api.github.com/users/satispunk","html_url":"https://github.com/satispunk","followers_url":"https://api.github.com/users/satispunk/followers","following_url":"https://api.github.com/users/satispunk/following{/other_user}","gists_url":"https://api.github.com/users/satispunk/gists{/gist_id}","starred_url":"https://api.github.com/users/satispunk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/satispunk/subscriptions","organizations_url":"https://api.github.com/users/satispunk/orgs","repos_url":"https://api.github.com/users/satispunk/repos","events_url":"https://api.github.com/users/satispunk/events{/privacy}","received_events_url":"https://api.github.com/users/satispunk/received_events","type":"User","site_admin":false},"created_at":"2017-09-10T16:01:35Z","updated_at":"2017-09-10T16:01:35Z","author_association":"NONE","body":"@AlexanderMoskovkin \r\nHi. I've test 17.2 version. The problems still exists.\r\nBut also found another way to reproduce it.\r\n\r\n1. Connect to another machine (virtual or real) using windows remote desktop connection\r\n2. Run tests which create screenshots\r\n3. Minimize remote desktop connection and wait some time until test run is finished\r\n\r\nI get the same error:\r\n\r\nWas unable to take a screenshot due to an error.\r\n\r\n  Command failed:\r\n  C:\\dev\\confirmit.hub.client\\node_modules\\testcafe-browser-tools\\bin\\win\\screenshot.exe\r\n  263454 chrome\r\n  C:\\dev\\confirmit.hub.client\\test\\testcafe\\reports\\screenshots\\2017-09-10_05-40-44\\test-1\\Chrome_60.0.3112_Windows_8.1_0.0.0\\1.png\r\n\r\n  Unhandled Exception: System.ComponentModel.Win32Exception: The handle is\r\n  invalid\r\n     at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY,\r\n  Int32 destinationX, Int32 destinationY, Size blockRegionSize,\r\n  CopyPixelOperation copyPixelOperation)\r\n     at System.Drawing.Graphics.CopyFromScreen(Point upperLeftSource, Point\r\n  upperLeftDestination, Size blockRegionSize, CopyPixelOperation\r\n  copyPixelOperation)\r\n     at BrowserTools.Screenshot.CaptureFromScreen(IntPtr hwnd, WindowInfo wi)\r\n     at BrowserTools.Screenshot.CaptureWindow(IntPtr hwnd, String\r\n  processName)\r\n     at BrowserTools.Screenshot.Main(String[] args)\r\n\r\n\r\nSo I assume that if the desktop is not shown physically then testcafe can't get window handle to make screenshot"}}
{"actor":{"display_login":"satispunk"}}