I
Innovators World Wide
Guest
With Webview1 becoming Obsolete (much quicker then the original "WebBrowser" component) I am making the switch from webview1 to webview2.
However ; just like transitioning from WebBrowser Control to WebView1 I had a lot to "learn" In this case I need to know how to change my "invoke script" to the newest format.
I know I have to
Imports Microsoft.Web.WebView2.Core.CoreWebView2
Then I know it has changed from InvokeScript to WebView.CoreWebView2.ExecuteScriptAsync , I know you can and should add the script to be executed on document ready. However my old style isn't working.
Old.
Dim name As String = Await WebView1.InvokeScriptAsync("eval", New String() {"document.getElementsByClassName('jsx-2835528490')[1].innerText.toString();"})
New
Dim name As String = Await WebView21.CoreWebView2.ExecuteScriptAsync("eval", New String() {"document.getElementsByClassName('jsx-2835528490')[1].innerText.toString();"})
I am being told it is
"Too Many Arguments" Which I understand (that is doesn't allow for the same number of arguments" however what can I change to make this work?
should it be just
WebView21.CoreWebView2.ExecuteScriptAsync("document.getElementsByClassName('jsx-2835528490')[1].innerText.toString();")
I'm missing something here.
Thank you everyone for your help
Continue reading...
However ; just like transitioning from WebBrowser Control to WebView1 I had a lot to "learn" In this case I need to know how to change my "invoke script" to the newest format.
I know I have to
Imports Microsoft.Web.WebView2.Core.CoreWebView2
Then I know it has changed from InvokeScript to WebView.CoreWebView2.ExecuteScriptAsync , I know you can and should add the script to be executed on document ready. However my old style isn't working.
Old.
Dim name As String = Await WebView1.InvokeScriptAsync("eval", New String() {"document.getElementsByClassName('jsx-2835528490')[1].innerText.toString();"})
New
Dim name As String = Await WebView21.CoreWebView2.ExecuteScriptAsync("eval", New String() {"document.getElementsByClassName('jsx-2835528490')[1].innerText.toString();"})
I am being told it is
"Too Many Arguments" Which I understand (that is doesn't allow for the same number of arguments" however what can I change to make this work?
should it be just
WebView21.CoreWebView2.ExecuteScriptAsync("document.getElementsByClassName('jsx-2835528490')[1].innerText.toString();")
I'm missing something here.
Thank you everyone for your help
Continue reading...