我正在尝试使用C#单击网站中的链接,但是很难使其正常工作。在IF语句中,一旦找到“证书”,我就能使该消息框正常工作,但实际上无法使用InvokeMember单击它。任何帮助将不胜感激。
HTML:
<div class="resource myapps-myfolder" title="Cert" isfolder="true" folder-path="Main/Cert">
<div class="myapps-icon-background"></div>
<a class="myapps-icon" href="#">
<img iconid="" src="uiareas/Store/media/FolderClosed32.png" alt="" class="iconImage">
</a>
<div class="myapps-name">Cert</div>
</div>
C#
private void btnCert_Click(object sender, EventArgs e)
{
var links = wbCerner.Document.GetElementsByTagName("div");
foreach (HtmlElement link in links)
{
if (link.GetAttribute("title").Equals("Cert"))
{
link.InvokeMember("click");
}
// MessageBox.Show("Test");
}
}