The InvokeScript method was deprecated in WebView2 so I am trying to learn the new alternative. According to the Microsft documentation, we have to call the ExecuteScriptAsync method in order to run a script. I was able to create an async method that executes my entire javascript function as a string and it worked. However, I find this approach not easy to debug; the ExecuteScriptAsync never tells you if there is a syntax error ...
How do you debug javascript code executed by the ExecuteScriptAsync?
Is there any other option to call javascript functions (with parameters)?
Thanks
AddScriptToExecuteOnDocumentCreatedAsyncmethod to inject the script. The benefit is you get intellisense in VS, which will tell you when you have syntax errors. Here's the method: learn.microsoft.com/da-dk/dotnet/api/…ExecuteScriptAsyncwhere there's no intellisense.