Extract scrape after browser is open

2019-08-22 16:12发布

I want to extract values from a webpage, I have to make multiple inputs and clicks before I can get to the data I want so I don't want to scrape until after I've selected all the search parameters.

I need the values after object and navigate happens after changing the search/narrowing down. I created a module, loaded internet controls etc. that's all working, page loads. After loading I change the search params on the page and I get updated results and THEN I want to extract the values. Any help would be appreciated….

update code involved:

I was trying to use shdocvw.internetexplorer

Sub PULLDATA()

Dim IE As Object
Dim ieObj As InternetExplorer
Dim htmlEle As IHTMLElement
Dim i As Integer


Set IE = GetIE("'URL Hidden")

' initialize i to one
i = 2
For Each htmlEle In IE.document.getElementsByClassName("number")       (0).getElementsByTagName("li")
    With ActiveSheet
        .Range("B" & i).Value = htmlEle.Children(0).textContent
        .Range("C" & i).Value = htmlEle.Children(1).textContent
        .Range("D" & i).Value = htmlEle.Children(2).textContent
        .Range("E" & i).Value = htmlEle.Children(3).textContent
        .Range("F" & i).Value = htmlEle.Children(4).textContent
    End With

    i = i + 1

Next htmlEle

End Sub

    .Quit

End With

Set ie = Nothing

End Sub

I am just starting to build this but the bones are here

I just need clarification, surely someone has a base code to add elements to the worksheet instead of automating then retrieve the values... I'm sure to make it once I've checked the various filters on the page, which contains the classes and divs, and updated the page which I have to do MANUALLY and can populate the specific sheet in the workbook

0条回答
登录 后发表回答