Forwarding Forwarding - 2 months ago 9
Ruby Question

How to programmatically click google maps icons

Take a look at this map:

enter image description here

This map pops up when you visit https://www.hertzcarsales.com/, and click "Change" next to with "Within X miles of Y" dropdown selector. Anyway, I cannot right click on the little H's to inspect with FireBug, and I can't seem to figure out how to access the urls attached to each using watir-webdriver.

When I click on an H I can do

b.as(:text,/Visit this Store/).href


but I can't get them all though.

Answer

From what I can tell, I don't think you can. If you peel the map down to where the pins are, they are contained in a CANVAS tag which Selenium cannot see inside.

I did find another way to get what you want. Go here instead, https://www.hertzcarsales.com/locations. Click on the blue "Find a Car Sales Location" button in the middle of the page. That will launch basically the same dialog except there are location summaries on the left side of the page. You can click the View All link in the top left. Now you have every location's info and you can grab the links you wanted.

Comments