我正在寻找代码来点击webbrowser上的那个按钮:
<a class="single_like_button btn3-wrap" onclick="openFbLWin_856604();">
<span> </span><div class="btn3">Subscribe</div></a>
我试过了:
For Each elem As HtmlElement In WebBrowser1.Document.GetElementsByTagName("a")
If elem.GetAttribute("class") = "single_like_button btn3-wrap" Then
elem.InvokeMember("click")
End If
For Each elem As HtmlElement In WebBrowser1.Document.GetElementsByTagName("div")
If elem.GetAttribute("class") = "btn3" Then
elem.InvokeMember("click")
End If
For Each elem As HtmlElement In WebBrowser1.Document.GetElementsByTagName("div")
If elem.InnerText = "Subscribe" Then
elem.InvokeMember("click")
End If
For Each elem As HtmlElement In WebBrowser1.Document.GetElementsByTagName("a")
If elem.InnerText = "Subscribe" Then
elem.InvokeMember("click")
End If
没有一个正常工作。
答案 0 :(得分:0)
在检查之前,使用FLAG_ACTIVITY_NO_HISTORY
方法从Intent refresh = new Intent(context, context.getClass());
refresh.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY|Intent.FLAG_ACTIVITY_NO_ANIMATION);
context.startActivity(refresh);
的两端删除空格:
Trim