I'm trying to run a PowerShell script I've found online, but every time I launch WebView2, all I see is a white screen. I've tested the script on three different Windows computers and even tried various WebView2 launchers, but nothing seems to work. I'm quite new to coding and have only solved a few simple issues with help from GitHub, so I don't have much experience with WebView2. Can anyone explain why this might be happening and how I can fix it? I've been stuck for a couple of days despite trying to follow advice I found online.
2 Answers
You might want to check if you're using PowerShell 5 instead of PowerShell 7. I've seen similar white screen issues happen due to that version difference.
Make sure you're loading a valid site into the WebView2. Sometimes, if you click and drag the window around, it can trigger the page to load correctly. I've had that issue with some Microsoft sites not rendering without moving the window. Give that a shot!
Have you thought about calling `.Refresh()` on the WebView control when the `NavigationCompleted` event fires? It might help with loading issues.
Thanks for the tip! I actually clicked and moved the window around for a bit, but still no luck. I'll keep trying, though.