An error on GetMainWindow function FlaUI C#

736 Views Asked by At

I'm using FlaUI library to automate desktop app.

I took an error on try to run code to take a window of launched program. Error: Could not find process with id: ***'

Details of error.

System.Exception
  HResult=0x80131500
  Message=Could not find process with id: 13536
  Source=FlaUI.Core
  StackTrace:
   at FlaUI.Core.Application.FindProcess(Int32 processId)
   at FlaUI.Core.Application.<WaitWhileMainHandleIsMissing>b__33_0()
   at FlaUI.Core.Tools.Retry.<>c__DisplayClass12_0.<WhileTrue>b__0()
   at FlaUI.Core.Tools.Retry.While[T](Func`1 retryMethod, Func`2 checkMethod, Nullable`1 timeout, Nullable`1 interval, Boolean throwOnTimeout, Boolean ignoreException, String timeoutMessage, Boolean lastValueOnTimeout, T defaultOnTimeout)
   at FlaUI.Core.Application.WaitWhileMainHandleIsMissing(Nullable`1 waitTimeout)
   at FlaUI.Core.Application.GetMainWindow(AutomationBase automation, Nullable`1 waitTimeout)
   at Program.<Main>$(String[] args) in C:\Users\jekug\source\repos\FlaUI test\FlaUI test\Program.cs:line 10

  This exception was originally thrown at this call stack:
    [External Code]

ArgumentException: Process with an Id of 13536 is not running.

What can be wrong and are there other ways to take a window in FlaUI?

Thank you enter image description here

enter image description here

1

There are 1 best solutions below

0
Roemer On

calc.exe on any newer windows is actually just a proxy executable to in the end run the "WindowsStoreApp" calculator which behaves quite differently. For those apps, you need to use LaunchStoreApp instead of Launch in order to get the correct process.