javascript - Get dom element by ID in WebView UWP -
i intend content of dom element website, cant use
var html = await client.getasync("http://example.com/test.html");
as specific dom element populated after js executed can use webview host content won't solve problem can't use htmldocument.getelementbyid method (string) either under system.windows.forms namespace isn't supported in universal windows platform! option invokeasync
await webview5.invokescriptasync("dosomething", null);
as seen in scenario 5 of xaml webview control sample fires events , won't in getting dom element (or source code once js execution done). //the app c# uwp, not winjs
you can use htmlagilitypack library query dom downloaded. see example here or search more, there plenty.
alternatively, can run javascript need , returns string containing id. see, invokescriptasync
returns string
can contain javascript returned. f.e., this how dom javascript:
var result = await this.webview.invokescriptasync("eval", new[] { "document.documentelement.outerhtml;" });
wiki
Comments
Post a Comment