uwpUsing JavaScript in WebView


Introduction

This document shows you how you can use JavaScript in WebView.

This document cover: Getting HTML from the WebView, Entering text in the text box on the website, Simulate click to click a website button

Syntax

  • await webView.InvokeScriptAsync("eval", new string[] { functionString }) - to use JavaScript
  • .documentElement - to get a reference to the root node of the document
  • .getElementsByClassName(Class_Name) - to get elements usign Class Name
  • .getElementsByTagName(Tab_Name) - to get elements using Tag Name
  • .getElementById(ID) - to get element using ID
  • .nodeName - to get the node name
  • .childNodes - to get the child elements
  • .outerHTML - to Get the Outer HTML
  • .innerHTML - to Get the Inner HTML
  • .innerText - to Get or Set InnerText
  • .click() - to Simulate click

Remarks