如何在网站vb.net中单击图像按钮

时间:2018-06-25 00:48:26

标签: vb.net

所以我试图用HTML代码单击网站中的图像按钮:

getUserInfo(){
  this.clientServ.getUser(this.id)
    .subscribe((data:any)=>{
      Object.assign(this.user, data);
    },err=>{
      console.log('there is an error lady ! ');
    });
}

我尝试过:

<a onclick="trylogin()"><img class="loginButton" src="/student/resource/AWSEd_Resource/img/search-execute.png"></a>

并且:

Dim element As HtmlElement = (From el As HtmlElement In WebBrowser1.Document.GetElementsByTagName("a").Cast(Of HtmlElement).Where(Function(h) h.GetAttribute("onclick") = "trylogin()")).FirstOrDefault()
        element.InvokeMember("click")

This is image button

1 个答案:

答案 0 :(得分:0)

尝试直接使用HtmlDocument.InvokeScript()执行脚本:

WebBrowser1.Document.InvokeScript("trylogin")