Hi There,
I'm having a lot of trouble trying to get a simple webscrape to work.
I am using a dynamic URL to search for a product (in this case 'GREENE KING ABBOT ALE') and what I'd like to do is have all the available links (HRef's) that return from the site to appear in column A of sheet called 'Single'
This code only intermittently works - it did work once, then it hasn't since - i think there are Javascript elements blocking the script from returning ALL urls.
My browser (Chrome) shows me a particular URL on the page:
"https://groceries.aldi.co.uk/e…ene-king-abbot-ale-500ml/5010549104614"
however I can't get this particular link to copy into my sheet.
Please can you help - spent all day getting this far and I'm running out of ideas
Would be so grateful!!
Sub webscrape()
Sheets("Single").Cells.Clear
Dim doc As HTMLDocument
Dim output As Object
Set IE = CreateObject("InternetExplorer.Application")
'Set IE = New InternetExplorer
IE.Visible = False
IE.Navigate "https://groceries.aldi.co.uk/en-GB/Search?keywords=GREENE+KING+ABBOT+ALE"
Do
DoEvents
Loop Until IE.ReadyState = READYSTATE_COMPLETE
Set doc = IE.Document
Set output = doc.getElementsByTagName("a")
i = 5
For Each Link In output
Sheets("Single").Range("A" & i).Value = Link
i = i + 1
Next
End Sub
Display More