所以我试图用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")
答案 0 :(得分:0)
尝试直接使用HtmlDocument.InvokeScript()
执行脚本:
WebBrowser1.Document.InvokeScript("trylogin")