0

From the below code, I could extract the href links from a website when it only had one page in it; but, when a website has multiple pages, the code below is not extracting the links from all of the pages. Therefore, I need to alter the code so that after extracting links from the first page, it should move to the next page and gets the links from that page as well, and similarly, it should loop through all of the existing pages and get the links extracted all the way to the last page. Kindly help me with this.

Option Explicit
Private chr As Selenium.ChromeDriver
Sub Product_List_Links()
    Set chr = New Selenium.ChromeDriver
    chr.Start
    chr.Get "https://ph.parker.com/us/en/series/vibration-isolators-and-mounts"
    chr.Wait 1000

        Dim Myurls As Selenium.WebElements
        Dim Myurl As Selenium.WebElement

    Set Myurls = chr.FindElementsByTag("a")

        For Each Myurl In Myurls
            If LCase(Myurl.Attribute("class")) = "a-no-underline" Then
            Debug.Print Myurl.Attribute("href")
            End If
        Next Myurl
    MsgBox "Done"
End Sub

The code above has to be modified in such a way that after extracting links from the first page, it moves on to the next page and gets the links from that page as well. In a similar manner, it should loop through all of the existed pages and get the links extracted all the way to the last page. Please provide a hand with this.

jaga jagga
  • 37
  • 3

0 Answers0