Resolved WebView2: How do I get the value of the element

Cecil

19+ years progress programming and still learning.
Code:
   @VisualDesigner.
    method private void webView21_NavigationCompleted( input sender as System.Object, input e as Microsoft.Web.WebView2.Core.CoreWebView2NavigationCompletedEventArgs ):
     

        define variable class1 as class     "System.Threading.Tasks.Task<character>".

        wait-for webView21:ExecuteScriptAsync("document.getElementById('request_id').value") set class1.
  message class1:Status:
     
        //message class1:Result class1:IsCompleted.
     
        return.

    end method.

I would like to get the value of an element in a web page using WebView2 web control.
I have been successful in setting an HTML element's value.
I have the above code working, but I just can't figure out how to get the actual value.
I have tried using the result property (which is meant to return a character value) but is blocking when called.
 
Last edited:

Cecil

19+ years progress programming and still learning.
Resolved!
I needed a time waist routine to check when the task has been completed.

Code:
@VisualDesigner.

    method private void webView21_NavigationCompleted( input sender as System.Object, input e as Microsoft.Web.WebView2.Core.CoreWebView2NavigationCompletedEventArgs ):

        define variable class1 as class     "System.Threading.Tasks.Task<character>".

        wait-for webView21:ExecuteScriptAsync("document.getElementById('request_id').value") set class1.

        //Time waist routine.
        do while not class1:IsCompleted:
            process events.
        end.

        message class1:Result view-as alert-box info.

        return.

    end method.
 
Top