Hello,
I wanna ask about vba for internet explorer automation
I use it on e-commerce web (shopxx) to scrape buyer link from other seller.
I have made script & it worked but I have a problem to refresh the Button object.
The step is:
- open IE for other seller rating page
- grab all the link & all button page
- open the new link in new IE
- follow them, close the new IE and looping per page
Since there only 5 button page when I first load the page, I try to repeat it.
in this code I try to repeat 2x (I use **FOR looping with variable varRepeat**).
what I want to ask is: <br>
- after clicking 5 page (5 button has been clicked) => worked
- when varRepeat=2
why the BtnPage didn't refresh to page 6-9, and it's still refer to button page 1-5 (on the 1st loading page).
eventhough I have place this command
Set ieBtnPage = objIE.Document.getElementsByClassName("shopee-button-no-outline")
So the program running for page 1, 2, 3, 4, 5, and back to 1, 2, 3, 4, 5
Thank you.
I wanna ask about vba for internet explorer automation
I use it on e-commerce web (shopxx) to scrape buyer link from other seller.
I have made script & it worked but I have a problem to refresh the Button object.
The step is:
- open IE for other seller rating page
- grab all the link & all button page
- open the new link in new IE
- follow them, close the new IE and looping per page
Since there only 5 button page when I first load the page, I try to repeat it.
in this code I try to repeat 2x (I use **FOR looping with variable varRepeat**).
what I want to ask is: <br>
- after clicking 5 page (5 button has been clicked) => worked
- when varRepeat=2
why the BtnPage didn't refresh to page 6-9, and it's still refer to button page 1-5 (on the 1st loading page).
eventhough I have place this command
Set ieBtnPage = objIE.Document.getElementsByClassName("shopee-button-no-outline")
So the program running for page 1, 2, 3, 4, 5, and back to 1, 2, 3, 4, 5
Thank you.
VBA Code:
Sub Followers()
Dim objIE As InternetExplorer
Dim ieAnchors As Object
Dim Anchor As Object
Dim ieBtnPage As Object
Set objIE = New InternetExplorer
objIE.Visible = True
objIE.Navigate "https://shoxxe.co.id/buyer/xxxxx/rating"
Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop
Application.Wait (Now + TimeValue("0:00:3"))
varRepeat = 1
For varRepeat = 1 To 2
Set ieBtnPage = objIE.Document.getElementsByClassName("shopee-button-no-outline")
For Each BtnPage In ieBtnPage
For Each Anchor In ieAnchors
result = Anchor
Dim objIE_1 As InternetExplorer
Dim ieBtn As Object
Dim Btn As Object
Set objIE_1 = New InternetExplorer
objIE_1.Visible = True
objIE_1.Navigate Anchor
Do While objIE_1.Busy = True Or objIE_1.ReadyState <> 4: DoEvents: Loop
Application.Wait (Now + TimeValue("0:00:3"))
Set ieBtn = objIE_1.Document.getElementsByClassName("shopee-button-outline shopee-button-outline--complement shopee-button-outline--fill ")
Do While objIE_1.Busy = True Or objIE_1.ReadyState <> 4: DoEvents: Loop
For Each Btn In ieBtn
Btn.Click
Next Btn
Application.Wait (Now + TimeValue("0:00:2"))
objIE_1.Quit
Next Anchor
BtnPage.Click
Next BtnPage
Next varRepeat
End Sub