❔ WinUI3 WebView2

Hello people, I'm having issues with WebView2. I am trying to ExecuteScriptAsync but it gives me the error "Method was called at an unexpected time". Here's my code:
2 Replies
gerard
gerard13mo ago
It's probably because you set the source, the browser starts loading the page and you instantly wants to execute the script; which doesn't work. Maybe you need to register to the event "DOMContentLoaded"?
Accord
Accord13mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.