在wpf web浏览器中使用mshtml单击按钮(无id)

在wpf web浏览器中使用mshtml单击按钮(无id),wpf,browser,mshtml,Wpf,Browser,Mshtml,我正在尝试使用mshtml填充WPF WebBrowser页面。但是,我无法从html中找到按钮的id。我怎样才能找到身份证?或者是否有其他方式提交表格 代码: Html页面(继续是按钮文本): WPF中的WebBrowser控件与WinForm中的控件不同 System.Windows.Controls.WebBrowser控件具有Document属性,该属性获取表示托管HTML页面的Document对象 您需要将此文档对象强制转换为COM接口IHTMLDocument2,然后访问文档上的a

我正在尝试使用mshtml填充WPF WebBrowser页面。但是,我无法从html中找到按钮的id。我怎样才能找到身份证?或者是否有其他方式提交表格

代码:

Html页面(继续是按钮文本):


  • WPF
    中的
    WebBrowser
    控件与
    WinForm
    中的控件不同

    System.Windows.Controls.WebBrowser控件具有Document属性,该属性获取表示托管HTML页面的Document对象

    您需要将此文档对象强制转换为COM接口
    IHTMLDocument2
    ,然后访问文档上的all属性以获取HTML文档中的每个元素

    mshtml.IHTMLDocument2 doc = webBrowser.Document as mshtml.IHTMLDocument2;
    doc.all.item("link")).click();
    
    请参阅MSDN文章:


    这里有一篇类似的帖子:
    WPF
    中的
    WebBrowser
    控件与
    WinForm
    中的控件不同

    System.Windows.Controls.WebBrowser控件具有Document属性,该属性获取表示托管HTML页面的Document对象

    您需要将此文档对象强制转换为COM接口
    IHTMLDocument2
    ,然后访问文档上的all属性以获取HTML文档中的每个元素

    mshtml.IHTMLDocument2 doc = webBrowser.Document as mshtml.IHTMLDocument2;
    doc.all.item("link")).click();
    
    请参阅MSDN文章:

    类似的帖子如下:

    mshtml.IHTMLDocument2 doc = webBrowser.Document as mshtml.IHTMLDocument2;
    doc.all.item("link")).click();