3
我只能在UWP Win 10之前找到舊的過時的答案。我知道如何以舊的方式做到這一點,但它給我帶來了問題。UWP Webview從網頁獲取鏈接到數組
我到目前爲止是在下面,請注意,問題似乎在於它不是通過標記名稱命令執行元素,就像我已經被告知它應該。儘管將其改爲內部HTML,並且它將用整頁填充html變量。所以我看不到自己的鏈接。
任何幫助表示讚賞!謝謝!
XAML
<Page
x:Class="webviewMessingAround.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:webviewMessingAround"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<WebView x:Name="webview" Source="http://regsho.finra.org/regsho-December.html" DOMContentLoaded="WebView_DOMContentLoaded" />
<Button x:Name="button" HorizontalAlignment="Left" Margin="145,549,0,0" VerticalAlignment="Top">
<Button x:Name="button1" Click="button_Click" Content="Button" Height="58" Width="141"/>
</Button>
</Grid>
</Grid>
</Page>
VB代碼
Private Async Sub webview_DOMContentLoaded(sender As WebView, args As WebViewDOMContentLoadedEventArgs) Handles webview.DOMContentLoaded
Dim html = Await webview.InvokeScriptAsync("eval", ({"document.getElementsByTagName('a');"}))
'Debug.WriteLine(html)
End Sub