Need Help on WEB automation

Sharid

Well-known Member
Joined
Apr 22, 2007
Messages
1,064
Office Version
  1. 2016
Platform
  1. Windows
I need a bit of help on web automation, my whole code only extracts the urls into column A, but I can not workout how to do the others in the remaining columns. appriciate if someone could have a look. I need the bits that are commented out in green in the code

VBA Code:
    '<h3 class="s-item__title s-item__title--has-tags">5" Android 8.1 Unlocked Cheap Mobile Smart Phone Quad Core Dual SIM WiFi 3G GPS</h3>
    '  <div class="s-item__subtitle">2020 NEW YEAR GIFT,1st 50% OFF,UK Stock</div>
    '<span class="SECONDARY_INFO">Brand new</span>
    '<span class="s-item__price">£31.85<span class="DEFAULT"> to </span>£38.58</span>
    '<span class="POSITIVE">FAST &amp; FREE</span>
    '<span class="BOLD">Free postage</span>
    '<span class="BOLD NEGATIVE">205+ sold</span>
    
   
    For Each link In HTMLDoc.getElementsByTagName("a")
            If link.getAttribute("class") = "vip" Then
                Cells(i, 1).Value = link.getAttribute("href")
                i = i + 1
            End If
        Next link
      
 If pageNumber >= 3 Then Exit Do 'the first 3 pages
        
        Set nextPageElement = HTMLDoc.getElementsByClassName("gspr next")(0)
        
        If nextPageElement Is Nothing Then Exit Do
        
        nextPageElement.Click 'next web page
        Do While IE.Busy Or IE.readyState <> 4
            DoEvents
        Loop
        Application.Wait Now + TimeSerial(0, 0, 5)
        Set HTMLDoc = IE.document
        pageNumber = pageNumber + 1
    Loop
IE.Quit
1582467012507.png

1582466943599.png
 
Hi. Do you have a copy of your code for me to look at? From your (very helpful and detailed) explanation above, it should be pretty straightfoward.
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Dan_W
Please see attached

You can download it from this link Download File On the userform, I have a few codes that I have done, the first button has the latest IF statement code I did today,

Also see this link that I posted regarding my new code Mr Excel Form
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,871
Members
449,055
Latest member
excelhelp12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top