陈一凡666 2019-05-28 14:56 采纳率: 0%
浏览 348

WPF中使用GetElementById,显示“object”未包含“getElementById”的定义

private void goNavigateButton_Click(object sender, RoutedEventArgs e)
{
// Get URI to navigate to

Uri uri = new Uri(this.addressTextBox.Text, UriKind.RelativeOrAbsolute);

        // Only absolute URIs can be navigated to  
        if (!uri.IsAbsoluteUri)
        {
            MessageBox.Show("The Address URI must be absolute eg 'http://www.microsoft.com'");
            return;
        }

        // Navigate to the desired URL by calling the .Navigate method  
        WebBrowser1.Navigate(uri);

            string s = WebBrowser1.Document.getElementById("txt1").Value;


    }
  • 写回答

1条回答 默认 最新

  • threenewbee 2019-05-30 11:04
    关注

    dynamic doc = WebBrowser1.Document;
    string s = doc.getElementById("txt1").Value;

    评论

报告相同问题?