Lead Generation

Google Maps Scraping with Selenium: Fix Common Issues

Troubleshoot and fix Google Maps scraping issues with Selenium — element not found, timeouts, browser automation detection.

Shan MauryaShan Maurya··8 min read
Google Maps Scraping with Selenium: Fix Common Issues

Let me tell you about the time I spent six hours trying to get Selenium to click a button. The button was RIGHT THERE. I could see it in the browser window. It was practically taunting me. But my script? My script kept insisting — with GREAT confidence — that this button did not exist. At all. Never existed. I tried every locator strategy known to humanity. Eventually I realized the page had two elements with the same ID, and Selenium was dutifully grabbing the hidden one, like a waiter bringing you the wrong dish and insisting you ordered it.

That is Google Maps scraping in a nutshell. The page lies to you. And your browser believes every single word.

scraping google maps

The first time I ran Selenium against Google Maps, I leaned back in my chair like a tech CEO about to watch data pour in. Instead, my browser opened blank. If you're new to the fundamentals, our complete guide on how to scrape Google Maps from scratch covers the basics before adding Selenium to the mix. My terminal filled with red exceptions. I had achieved nothing.

Here's the thing: Google Maps is FORTRESS. It's a single-page application that lazy-loads — no, that's too soft a word. It HIDES elements from you. Your script literally cannot see them until they render in the DOM, and they only render after specific user interactions or scroll positions. It's like trying to read a book where the words only appear AFTER you've turned the page, but you can't turn the page until the words appear. (Selenium wait documentation)

The fix? Abandon implicit waits. FOREVER. Never look back. Use WebDriverWait with expected_conditions on EVERY. SINGLE. INTERACTION. Every search, every click, every scroll. If you write find_element without a preceding wait, you are not writing code — you are writing a promise to yourself that you will get a NoSuchElementException, and Google will happily, gleefully, serve you one every time.

python search google

Running a Python search into Google Maps from Selenium is like trying to pour water into a cup through a straw that's been tied in a knot. Google Search and Maps render COMPLETELY differently. The clean fix: construct the Maps URL directly — https://www.google.com/maps/search/{query}/@{lat},{lng},{zoom}z — and use driver.get(). (Google Maps URL parameters)

This skips the search redirect entirely. A 2025 HasData benchmark found URL construction 40% less likely to trigger rate limiting on the first load than using the search box. Forty percent. Just for building a URL correctly.

html scraps

Google Maps randomizes CSS class names on EVERY deployment. You know that div[class*="fontBodyMedium"] that worked yesterday? POOF. Gone tomorrow. (Browserless anti-detection research)

Stop using class names. I am BEGGING you. Target by aria-label, role, or data-item-id instead. The div[role="feed"] container has stayed stable for YEARS. It's the one honest element in a sea of lies. Better yet, capture driver.page_source and parse it with BeautifulSoup — that separates navigation from parsing and tolerates DOM variations like a zen master tolerates annoying questions.

IssueBreakable SelectorStable Alternative
Results container.lI9IFe (randomized)div[role="feed"]
Business namediv.qBF1Pddiv[role="heading"]
Ratingspan.UY7F9 (may be missing)aria-label containing "stars"
Search inputVariousinput#searchboxinput
Address.W4Efsd//button[@data-item-id="address"]//text()

google maps extractor

A Google Maps extractor needs three phases. Think of it like a heist movie, but instead of stealing a diamond, you're stealing business addresses.

Phase one: scroll the div[role="feed"] container (NOT the window — the difference will save you hours of debugging) with execute_script("arguments[0].scrollTop = arguments[0].scrollHeight", feed) and random 1.5–3.5s pauses. Phase two: deduplicate results by place ID — Google re-renders the panel during scrolls and duplicates appear like unwanted guests at a party. (Apify scaling benchmarks) Phase three: click results for detail panels only when the sidebar scrape missed the phone or website.

This phased approach runs for hours without crashing. I know because I've tested it, and by "tested" I mean "left it running overnight and woke up panicked that it would have crashed, but it hadn't."

lead scraping

Here is where I get honest with you, and more importantly, with myself.

After building SIX Selenium scrapers and watching every single one break within weeks — sometimes DAYS — I started asking an uncomfortable question: is there a genuinely better approach? (HasData: Selenium vs Playwright vs API comparison)

Selenium gives you total control. That sounds like a good thing. But total control also means total responsibility for slow execution, fragile selectors, proxy costs, CAPTCHA threats, and the existential dread of wondering whether your scraper still works while you're on vacation.

If your goal is lead generation — and not, say, a PhD in Browser Automation — then consider a tool that already solved this. LeadsAgent is a browser extension that searches Google Maps, visits websites, verifies data, and builds a structured spreadsheet from a plain-language prompt. No selectors to maintain. No waits to tune. No CAPTCHAs to fight. The Starter plan is $10/month billed annually for 10,000 monthly credits, with a free tier for testing. For agencies producing leads at volume, it eliminates the maintenance headache entirely and lets you focus on outreach instead of browser automation.

If you MUST stick with Selenium — and I respect that decision, even if I think it's a bit masochistic — use undetected-chromedriver. It patches the navigator.webdriver flag, removes automation artifacts from the browser fingerprint, and cuts detection rates significantly. (undetected-chromedriver docs) Combine it with rotating residential proxies and a pool of at least 20 recent Chrome user-agent strings. And for the love of all that is holy, handle the GDPR cookie banner. It will silently eat your first search EVERY SINGLE TIME, then leave you wondering why nothing appeared. I lost two days to that banner.

FAQ

Why does my Selenium script return "NoSuchElementException" on Google Maps?

Because the element hasn't loaded yet. Google Maps renders content asynchronously — it's not being difficult, it's just... being Google Maps. Replace find_element with WebDriverWait(driver, 10).until(EC.presence_of_element_located(...)) to wait up to 10 seconds before throwing the error. Your script is not impatient — it's just early.

How do I avoid getting blocked scraping Google Maps with Selenium?

Use undetected-chromedriver, rotate user agents from a pool of recent Chrome strings, add 1.5–3.5s randomized delays between actions, and use residential proxies. Avoid standard headless mode — use --headless=new with undetected-chromedriver. Think of it as putting a disguise on your robot.

Why does my scraper only get 6 results instead of 20+?

You are scrolling the document body instead of the results panel. It's the single most common mistake and it will make you feel like an absolute idiot when you realize it. Target the div[role="feed"] container with execute_script("arguments[0].scrollTop = arguments[0].scrollHeight", feed_div) — NOT window.scrollTo(). I made this mistake for three days once.

What is the difference between Selenium and Playwright for Maps scraping?

Playwright uses WebSocket-based browser control that avoids the navigator.webdriver flag entirely. Selenium has a larger community. In 2026, Playwright with stealth plugin generally outperforms Selenium on detection resistance. (Browserless anti-detection guide) So if you're starting fresh today and not emotionally attached to Selenium, you know what to do.

Are Google Maps CSS classes permanent?

NO. Google randomizes class names like div.qBF1Pd or span.UY7F9 across deployments. Use stable attributes — aria-label, role, data-item-id. For more context, see the Google Maps Data Extraction Failed guide.

Can I use Selenium to scrape 10,000+ listings daily?

Technically yes. Practically? Hah. Selenium is slow (~3–5 min per 50 reviews), fragile, and proxy-heavy. For scale, use the Places API or a managed tool. LeadsAgent handles high-volume extraction natively with 50,000 monthly credits on the Professional plan.

How do I extract phone numbers and emails from Maps?

Phone numbers appear in the detail pane — target button[data-item-id*="phone"]. Emails are rarely on Maps directly; visit each business's website contact page. LeadsAgent automates email extraction from public website pages during its verification pass, because I have better things to do than individually check 500 contact pages.

US courts have generally protected scraping public data (hiQ Labs v. LinkedIn). GDPR adds complexity for personal data. Consult a lawyer for production scrapers. API-based tools like LeadsAgent avoid these gray areas entirely, which is nice if you'd rather not be a test case for internet law.

Selenium is a legitimate choice if you need fine-grained control, if you are building a one-time research dataset, or if your compliance team requires complete transparency into every HTTP request your scraper makes. For those cases, the techniques above — WebDriverWait with expected conditions, direct URL construction, attribute-based selectors, phased extraction, undetected-chromedriver, and proxy rotation — will keep your scraper running far longer than the naive approach. I have used every single one in production. I have the emotional scars to prove it.

Your Time vs. a DOM Selector

Here is where I get REALLY honest with you. And with myself.

I have debugged enough Selenium scripts to know that my time — my ACTUAL time on this planet — is better spent on outreach, strategy, and closing deals than chasing random class names on a Thursday afternoon. Your time is worth something. And maintaining a Selenium scraper is a TAX on that time.

If your goal is lead generation — and not browser automation education — then download LeadsAgent and extract 50,000 leads without writing a single wait condition. It is free to test. No credit card required. The Starter plan at $10/month (billed $120/year) covers 10,000 monthly credits including email extraction, enrichment, and agentic extraction. For agencies running constant outreach campaigns, that changes the math ENTIRELY.

The question is not whether Selenium can work. It can. The question is whether maintaining it is the best use of your time. I know which answer I landed on. And honestly? Past Me was a bit of an idiot for not landing on it sooner.

Shan Maurya

Written by

Shan Maurya

We write about lead generation, cold outreach, and agency growth. Every guide is based on real workflows and real data from practitioners who use these tools daily.

Get 100 free leads from Google Maps

No credit card. No setup. Just install and start extracting.

↓ Export sample leads