web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Fail to capture image ...
Power Automate
Unanswered

Fail to capture image on Take screenshot of a webpage action

(2) ShareShare
ReportReport
Posted on by 127
 

I am using a flow where, in some point,  I use the "Take screenshot of a webpage" action, with the "Capture:Specific element" option. The problem is that for some time, the flow has been randomly stuck in that step with "failed to capture image" error.
Sometimes it crashes after 5 - 10 screenshots, other times immediately after running. I made multiple selectors of that UI element but in vain.

I don't get it. I have the "Wait for web page content" before, with the same UI element and flow is passes with no error.

I reinstalled PAD and Firefox add-on (I am using Firefox browser) but no results.

 

Any insight will be appreciated. Thanks!

 

 

Errors message:

 

Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Failed to capture image. ---> PInvoke.Win32Exception: Invalid window handle
at PInvoke.User32.GetWindowPlacement(IntPtr hWnd)
at Microsoft.Flow.RPA.Desktop.UIAutomation.Core.Native.Window.WANativeWindow.<>c__DisplayClass67_0.<BringToFront>b__1()
at Microsoft.Flow.RPA.Desktop.UIAutomation.Core.Utilities.Clock.Execute[T](Int64 maxMillisecondsToWait, Int32 step, Func`1 action, Func`2 successCondition)
at Microsoft.Flow.RPA.Desktop.UIAutomation.Core.Native.Window.WANativeWindow.BringToFront(Boolean ensureForegroundStatus, Boolean useWindowStateHacks, Int32 timeout)
at Microsoft.Flow.RPA.Desktop.UIAutomation.WebAutomation.Core.Browser.AutomationBrowserBase.EnsureWindowIsVisible(INativeWindow waNativeWindow)
at Microsoft.Flow.RPA.Desktop.UIAutomation.WebAutomation.Core.WebExtensionsBrowser.WebExtensionsBrowserBase.CaptureWebPageImage(Single scaling, Int32 tryCount)
at Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.WebAutomationRuntime.TakeScreenshotOfWebPage(IWebAutomationBrowser webExtensionsBrowser, String cssSelectorOfElementToCapture, WebPageImageCapturingOperationEnum webPageImageCapturingOperation)
at Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.WebAutomationActions.TakeScreenshotOfWebPage(IWebBrowserInstanceFacade webBrowserInstance, String cssSelectorOfElementToCapture, String fileName, Int32 webPageImageCapturingOperation, Boolean copyToClipboard, Int32 fileFormat)
at Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.TakeScreenshotBase.Execute(ActionContext context)
--- End of inner exception stack trace ---
at Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.TakeScreenshotBase.Execute(ActionContext context)
at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)

 

Error actionError action

 

 

 

Action settingsAction settings

 

 

I have the same question (0)
  • ViliBit Profile Picture
    127 on at

    Still banging my head ....

    What does "Exception: Invalid window handle" mean??

  • momlo Profile Picture
    1,527 Super User 2024 Season 1 on at

    I had similar issue with same error msg few releases ago, when PAD changed the way handle was stored in a variable, let me see my email to MS support

     

    This, but it was affecting my flows when i moved to 2.18, and had no issues with this with several latest releases

     

    momlo_0-1664528710356.png

     

  • ViliBit Profile Picture
    127 on at

    Two versions later and the problem still persists. I was hoping that with the newer update the problem will be solved. But the problem is still here.

    It is the only thing that ruins what could have been a beautiful flowing flow!!!

  • bogdantudose Profile Picture
    6 on at

    I have the same issue. Waiting for a fix

  • TengkuMaestro Profile Picture
    14 on at

    any update about the issue? i am facing the same issue with my flow

  • matrix187 Profile Picture
    4 on at

    I am experiencing the same issue as well. I will disable the action for now and wait and see I guess.

  • ZhenfenZhan Profile Picture
    2 on at

    Any solution for this error so far? I am facing similiar error.

    Correlation Id: 39d2045c-3ab8-477c-893b-fb95b35f39ef
    
    Parameter is not valid.: Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Failed to capture image. ---> System.ArgumentException: Parameter is not valid.
     at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
     at Microsoft.Flow.RPA.Desktop.UIAutomation.WebAutomation.Core.WebExtensionsBrowser.WebExtensionsBrowserBase.CaptureWebPageImage(Single scaling, Int32 tryCount)
     at Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Common.WebAutomationRuntime.TakeScreenshotOfWebPageImpl(IWebAutomationBrowser webExtensionsBrowser, String cssSelectorOfElementToCapture, WebPageImageCapturingOperationEnum webPageImageCapturingOperation)
     at Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Common.WebAutomationRuntime.TakeScreenshotOfWebPage(IWebAutomationBrowser webBrowserInstance, String cssSelectorOfElementToCapture, String fileName, Int32 webPageImageCapturingOperation, Boolean copyToClipboard, Int32 fileFormat)
     at Microsoft.Flow.RPA.Desktop.UIAutomation.AutomationServer.Host.WebAutomationRuntimeService.<>c__DisplayClass29_0.<TakeScreenshotOfWebPage>b__0(IWebAutomationBrowser b)
     at Microsoft.Flow.RPA.Desktop.UIAutomation.AutomationServer.Host.WebAutomationRuntimeService.<>c__DisplayClass31_0.<GetBrowserAndExecute>b__0(IWebAutomationBrowser b)
     at Microsoft.Flow.RPA.Desktop.UIAutomation.AutomationServer.Host.WebAutomationRuntimeService.GetBrowserAndExecute[T](Func`2 action, WebBrowserInfo browserInfo)
    --- End of remote exception stack trace ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at Microsoft.Flow.RPA.Desktop.UIAutomation.Shared.Rpc.RpcDispatchProxy`1.GetRemoteResultOrThrow(RemoteMethodCallResponse response, Type expectedResultType)
     at Microsoft.Flow.RPA.Desktop.UIAutomation.Shared.Rpc.RpcDispatchProxy`1.Invoke(MethodInfo targetMethod, Object[] args)
    --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at System.Reflection.DispatchProxyGenerator.Invoke(Object[] args)
     at Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.WebAutomationRuntimeServiceProxy.<>c__DisplayClass30_0.<TakeScreenshotOfWebPage>b__0(IWebAutomationRuntimeService s)
     at Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.WebAutomationRuntimeServiceProxy.<>c__DisplayClass32_0.<ExecuteSafe>b__0(IWebAutomationRuntimeService s)
     at Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.WebAutomationRuntimeServiceProxy.ExecuteSafe[T](Func`2 action, TimeSpan timeout)
     at Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.WebAutomationRuntimeServiceProxy.ExecuteSafe(Action`1 action, TimeSpan timeout)
     at Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.TakeScreenshotBase.<Execute>b__21_0(IWebAutomationRuntimeService s)
     at Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.WebAutomationActionBase.<>c__DisplayClass4_0.<PerformWebAutomationWithLogging>b__0(IWebAutomationRuntimeService s)
     at Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.WebAutomationActionBase.PerformWebAutomationWithLogging[T](Func`2 action, WebAutomationRuntimeLogData requestData, Func`3 resultData)
     at Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.TakeScreenshotBase.Execute(ActionContext context)
     --- End of inner exception stack trace ---
     at Microsoft.Flow.RPA.Desktop.Modules.WebAutomation.Actions.TakeScreenshotBase.Execute(ActionContext context)
     at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 664

#2
Haque Profile Picture

Haque 460

#3
Valantis Profile Picture

Valantis 357

Last 30 days Overall leaderboard