我想点击搜索图标,如下所示
我尝试传递节点的id
但没有成功。
以下是参考资料的HTML代码:
<a id="ctl00_CPHMainSearch_hypOpenProjectPopup" href="javascript:void(window.open('ProjectPopUp.aspx?ctl00_CPHMainSearch_AutoCompPR_SearchTxt=1&ctl00_CPHMainSearch_AutoCompPR_IDValue=2&ViewPopMode=ProjectSearch', 'ProjectPopUpaspx', 'scrollbars=yes,width=750,height=600,top=40,left=200,resizable=yes,status=yes,toolbar=no'));"><img style="border-width: 0px;" alt="" src="../Images/popup.gif"></a>
我尝试了一些代码,但没有运气: -
Dim ProjectSearch As Object
设置ProjectSearch = IE.document.getElementById(“ctl00_CPHMainSearch_hypOpenProjectPopup”) ProjectSearch.Click
但显示错误OBJECT必需
以下是代码的一部分: -
Sub code()
Dim IE As InternetExplorer
User_Name = Environ$("UserName")
Set IE = New InternetExplorerMedium
IE.Silent = True
IE.navigate "url"
IE.Visible = True
Dim ProjectSearch As Object
Set ProjectSearch =
HtmlDoc.getElementById("ctl00_CPHMainSearch_hypOpenProjectPopup")
ProjectSearch.Click
End Sub