如何自动点击网页link?
How to click on a web page link automatic?
下面的代码是我需要点击的link被埋没的地方
我已经弄清楚如何以编程方式浏览网站和登录网站。但是,现在我需要能够自动导航站点,但我无法管理它。
包含"Time Clock Entry"的行是我需要点击的link...
我是编码新手。这是我的第一个项目。
对不起。我没有意识到我之前的 copy/paste 被缩短了。我已更正包含 link.
的行
再次感谢。
<div id="dockedContent" class="dockedContent">
<div id="RecentlyVisitedWidget" class="recentlyVisitedWidget">
<h2 id="ctl00_12_12_RecentlyVisitedLabel"></h2>
<ul class="recentlyVisitedLinks">
<li>
<span id="ctl00_12_12_Repeater1_ctl00_link">
<a href="#" onclick="recentlyVisitedSelect('pages/VIEW/UTMEntry.aspx?USParams=PK=ESS!MenuID=2147!PageRerId=2147!ParentRerId=72','72','2147','2147', false, false, 'Time Clock Entry', true)" title="Time Clock Entry">Time Clock Entry</a>
</span>
</li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</div>
您可以通过以下方式找到 link:
HtmlElement link = (from HtmlElement elem in webBrowser.Document.GetElementsByTagName("a")
where elem.GetAttribute("title") == "Time Clock Entry"
select elem).ElementAt(0);
这基本上就是说 "get all a
tags in the document (and thus all links), and then filter so that I get only a
tags with a title of Time Clock Entry
. Once you've done that, give me the first such element."
然后以编程方式单击它:
link.InvokeMember("Click");
下面的代码是我需要点击的link被埋没的地方
我已经弄清楚如何以编程方式浏览网站和登录网站。但是,现在我需要能够自动导航站点,但我无法管理它。
包含"Time Clock Entry"的行是我需要点击的link...
我是编码新手。这是我的第一个项目。
对不起。我没有意识到我之前的 copy/paste 被缩短了。我已更正包含 link.
的行再次感谢。
<div id="dockedContent" class="dockedContent">
<div id="RecentlyVisitedWidget" class="recentlyVisitedWidget">
<h2 id="ctl00_12_12_RecentlyVisitedLabel"></h2>
<ul class="recentlyVisitedLinks">
<li>
<span id="ctl00_12_12_Repeater1_ctl00_link">
<a href="#" onclick="recentlyVisitedSelect('pages/VIEW/UTMEntry.aspx?USParams=PK=ESS!MenuID=2147!PageRerId=2147!ParentRerId=72','72','2147','2147', false, false, 'Time Clock Entry', true)" title="Time Clock Entry">Time Clock Entry</a>
</span>
</li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</div>
您可以通过以下方式找到 link:
HtmlElement link = (from HtmlElement elem in webBrowser.Document.GetElementsByTagName("a")
where elem.GetAttribute("title") == "Time Clock Entry"
select elem).ElementAt(0);
这基本上就是说 "get all a
tags in the document (and thus all links), and then filter so that I get only a
tags with a title of Time Clock Entry
. Once you've done that, give me the first such element."
然后以编程方式单击它:
link.InvokeMember("Click");