• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Trouble clicking on some links cyclically

shahin

Active Member
I've written a script using IE to click on some links listed in the sidebar of google maps. When any of the items get clicked, the related information attached to each lead shows up in the right sided area. However, after clicking once I could not make my scraper move on to go for the rest of the clicks, I meant click cyclically. I tried with dictionary and failed to do it as well. At this point I can't figure out where I'm going wrong.

Webpage link: https://www.google.com.sg/search?q=singapore bars&rlz=1C5CHFA_enSG722SG726&oq=singapore bars&aqs=chrome..69i57j0j69i60l2j0l2.2182j0j4&sourceid=chrome&ie=UTF-8&npsic=0&rflfq=1&rlha=0&rllag=1284410,103851311,350&tbm=lcl&rldimm=5846980261362218103&ved=0ahUKEwiwjP_F5PzZAhVJyLwKHSq_A1oQvS4IRTAA&rldoc=1&tbs=lrf:!2m1!1e2!2m1!1e3!3sIAE,lf:1,lf_ui:9#rlfi=hd:;si:5409787051100677281;mv:!1m3!1d8954.049147902966!2d103.84678164999998!3d1.2876003!2m3!1f0!2f0!3f0!3m2!1i602!2i431!4f13.1;start:0

Here is what I've tried so far:

Code:
Sub Fetch_Info()
    link$ = "https://www.google.com.sg/search?q=singapore%20bars&rlz=1C5CHFA_enSG722SG726&oq=singapore+bars&aqs=chrome..69i57j0j69i60l2j0l2.2182j0j4&sourceid=chrome&ie=UTF-8&npsic=0&rflfq=1&rlha=0&rllag=1284410,103851311,350&tbm=lcl&rldimm=5846980261362218103&ved=0ahUKEwiwjP_F5PzZAhVJyLwKHSq_A1oQvS4IRTAA&rldoc=1&tbs=lrf:!2m1!1e2!2m1!1e3!3sIAE,lf:1,lf_ui:9#rlfi=hd:;si:5409787051100677281;mv:!1m3!1d8954.049147902966!2d103.84678164999998!3d1.2876003!2m3!1f0!2f0!3f0!3m2!1i602!2i431!4f13.1;start:0"
    Dim HTML As HTMLDocument, posts As Object, post As Object, elem As Object
  
    With CreateObject("InternetExplorer.Application")
        .Visible = True
        .navigate link
        While .Busy = True Or .readyState < 4: DoEvents: Wend
        Set HTML = .document

        Do: Set posts = HTML.querySelector(".dbg0pd"): DoEvents: Loop While posts Is Nothing
        For Each post In HTML.getElementsByClassName("dbg0pd")
            post.Click
        Next post
    End With
End Sub

Any help on this will be highly appreciated.

I'm attaching an image below indicating the links I wanna click cyclically.
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    21.7 KB · Views: 7
Back
Top