如何使用VBScript单击网页上的链接 [英] How to click a Link on a webpage using VBScript

查看:63
本文介绍了如何使用VBScript单击网页上的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上,我必须单击一个链接,结果将给出两个菜单列表,因为我需要选择其中任何一个

Actually i have to click on a link and as a result it will be give two menu list in that i need to select any of those

这是我的VBScript,用于启动IE并导航到所需的Web地址

here is my VBScript for launching IE and navigate to required web adress

Dim URL 
Dim IE 
Set IE = CreateObject("internetexplorer.application")
URL = "http://it-asg.uhc.com/sites/gcas/pcas/archive/PCR/IVM/modlist/Lists/ElementTracker/AllItems.aspx" 
IE.Visible = True
IE.Navigate URL

任何人都可以帮助我单击该链接并选择那些菜单中的任何一个吗?链接的来源

Can any any one help me out to click on that link and select any one of those menu source for the link

链接的实际来源:

<a id="zz13_ListActionsMenu" accesskey="C" href="#" onclick="javascript:return false;" style="cursor ointer;white-space:nowrap;" onfocus="MMU_EcbLinkOnFocusBlur(byid('zz8_RptControls'), this, true);" onkeydown="MMU_EcbLinkOnKeyDown(byid('zz8_RptControls'), MMU_GetMenuFromClientId('zz13_ListActionsMenu'), event);" oncontextmenu="this.click(); return false;" menutokenvalues="MENUCLIENTID=zz13_ListActionsMenu,TEMPLATECLIENTID=zz8_RptControls" serverclientid="zz13_ListActionsMenu">Actions<img src="/_layouts/images/blank.gif" border="0" alt="Use SHIFT+ENTER to open the menu (new window)."></a>

预先感谢

推荐答案

在这种情况下,您可以使用方法"getElementById".例如:

For this scenario you can use the method "getElementById". For example:

IE.Document.getElementById("zz13_ListActionsMenu").Click

因此您的代码将类似于:

So your code will look something like:

Dim URL 
Dim IE 
Set IE = CreateObject("internetexplorer.application")
URL = "http://it-asg.uhc.com/sites/gcas/pcas/archive/PCR/IVM/modlist/Lists/ElementTracker/AllItems.aspx" 
IE.Visible = True
IE.Navigate URL


 Do While IE.Busy
    WScript.Sleep 100
 Loop

IE.Document.getElementById("zz13_ListActionsMenu").Click

您还可以使用其他方法来访问和单击页面上的元素,有关列表,请参阅以下内容:

There are also other methods you can use to access and click elements on a page, I refer to the following for a list:

http://msdn.microsoft.com/en-us/library/ie/ms535862(v = vs.85).aspx

这篇关于如何使用VBScript单击网页上的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆