VBA and IE8 - enter value and search

2019-05-26 11:08发布

问题:

I have an intranet based website at work that I'd like to input SKU's and scrape the data that comes up into an excel sheet using VBA and IE8. Currently waiting on Access license approvals and approval to gain access to our IBM as400 server. IE8 does not support getElementsByName, and the search bar has no ID, so most of the examples I've found online aren't relevant.

Sub scraper()

Dim item As Long

item = "10011" 'this will eventually be placed in a loop for multiple searches

Set objIE = CreateObject("InternetExplorer.Application")
  objIE.Visible = True
' navigate and download the web page
  objIE.Navigate "http://**********.aspx"
Do While objIE.ReadyState <> 4 Or objIE.Busy
    DoEvents
Loop

objIE.document.getElementsByName("input").Value = item


End Sub

Here's a photo of the inspected element tree. As you can see, there is only a name (input) and class (st1), no ID. How can i get the search data input into this area? I am stuck with IE8, although I do have access to Chrome as well...