VBA and IE8 - enter value and search

走远了吗. 提交于 2019-12-10 10:36:44

问题


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...

来源:https://stackoverflow.com/questions/39283281/vba-and-ie8-enter-value-and-search

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!