使用Excel单击Java脚本button

我正在尝试使用VBA单击以下网站上的Java脚本button: http : //www.ura.gov.sg/realEstateIIWeb/transaction/search.action

我试图让vbaselect一个项目,然后点击标记为“添加”的button,然后点击上面的networking链接中标有“search”的button。

我已经设法让VBA打开网站并select项目,但一些如何我无法获得VBA点击“添加”button和“search”button

Sub DLDATA() Dim MAS As Object Dim STYR As Object Dim DLD As Object Dim XLD As Object Dim form As Variant, button As Variant Set MAS = CreateObject("InternetExplorer.application") 

MAS

 .Visible = True .Navigate Sheets("Property Value").Range("B30").Value ' Navigate to website Do Until .ReadyState = 4 DoEvents Loop Set STYR = MAS.Document.all.Item("projectNameList") STYR.Value = Sheets("Property Value").Range("A1").Value ' Select name of property based on name in cell A1. Set XLD = MAS.Document.all.Item("addOpt") XLD.Value = Sheets("Property Value").Range("A1").Value End With End Sub 

这对我有用

 Sub test() URL = "http://www.ura.gov.sg/realEstateIIWeb/transaction/search.action" Set ie = CreateObject("InternetExplorer.Application") ie.Visible = True ie.navigate URL Do Until (ie.readyState = 4 And Not ie.Busy) DoEvents Loop Set STYR = ie.Document.all.Item("projectNameList") STYR.Value = Sheets("Property Value").Range("A1").Value ' Select name of property based on name in cell A1. Set Results = ie.Document.getElementsByTagName("input") ' find and click the "add" button For Each itm In Results If InStr(1, itm.outerhtml, "addOpt", vbTextCompare) > 0 Then itm.Click Exit For End If Next ie.Document.getElementByID("searchForm_0").Click ' click the "search" button Do Until (ie.readyState = 4 And Not ie.Busy) DoEvents Loop ' do whatever End Sub