I have a code like below,
public partial class LawView : UserControl
{
public LawView()
{
InitializeComponent();
InitializeAsync();
}
async void InitializeAsync()
{
await webView.EnsureCoreWebView2Async(null);
webView.Source = new System.Uri("https://klimedsoft.pl/strefa-klienta/");
webView.Focus();
await webView.CoreWebView2.ExecuteScriptAsync("(function() { document.getElementById('user').value = 'blahblahusername'; document.getElementById('password').value = 'blahpassword'; })()");
await webView.CoreWebView2.ExecuteScriptAsync("(function() { document.getElementsByName('wp-submit')[0].click(); })()");
}
}
in the console, the scripts run without any problems, but when I run them in the application, the fields in the open page do not fill me up. What am I doing wrong? Is there something missing?
I've already searched stackoverflow and other sites. I found nothing to lead me to a solution. I will be grateful for any help.