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:
Any help on this will be highly appreciated.
I'm attaching an image below indicating the links I wanna click cyclically.
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.