Scraping

How to Scrape Glassdoor with Puppeteer and BAP

Puppeteer for job listings, BAP for Cloudflare-protected company pages.

TL;DR

  • Match stable attributes. To scrape Glassdoor is to pull job listings and company reviews out of its pages with a script. The generated class names change with every front-end release, so match job cards on attributes like data-test="jobListing" instead.
  • Skip hard-coded user agents. A user agent copied from an older Chrome release gets headless Puppeteer a 403 "Security | Glassdoor" page. Taking the browser's own user agent and swapping HeadlessChrome for Chrome loads the job listings.
  • Read the JSON-LD. Company and review pages embed the rating, review count, and reviews as schema.org JSON-LD. They also sit behind a Cloudflare challenge, which a BAP session with a US residential proxy and page.solve() clears.

Introduction

If you're tracking who's hiring, comparing what a role pays, or watching how employees rate a company, it's quicker to scrape Glassdoor than to copy the data out by hand. Your first headless Puppeteer run will probably return a security page with no job listings, though, and company pages put a Cloudflare challenge in front of the ratings and reviews.

In this article, you'll learn how to load Glassdoor's job search pages in Puppeteer with one user agent change, save each job's title and salary estimate to a CSV file, and collect company ratings and reviews from the protected pages with Browserless's Browser Automation Protocol (BAP).

How the Glassdoor website is organized

Glassdoor splits its data across separate page types, and each type follows its own URL pattern. Knowing which page holds which field tells you where to point your scraper.

Table of Glassdoor fields showing which page holds each one, the data-test attribute or JSON-LD type it is read from, and whether it loads in local Puppeteer or needs a BAP session with a proxy and Cloudflare solve.

Job search results, company, and salary pages

Job search results pages list 30 jobs per page. Each card shows the job title, company, location, salary estimate, and a short description snippet.

A keyword search at https://www.glassdoor.com/Job/jobs.htm?sc.keyword=[keyword] redirects to a location-based URL such as /Job/new-york-software-engineer-jobs-SRCH_IL.0,8_IC1132348_KO9,26.htm. That longer form is the one the code in this guide uses.

Each company has an overview page for company information and a reviews page, both keyed by the company ID, the unique identifier Glassdoor gives every employer. Google's ID is 9079, so its overview sits at /Overview/Working-at-Google-EI_IE9079.htm and its reviews at /Reviews/Google-Reviews-E9079.htm.

Both company pages carry the company's star rating, the review count, and a few recent reviews. On the reviews page, a logged-out visitor sees three reviews before a sign-in overlay blurs the rest.

Salary pages report salary ranges for one job title, either nationally at /Salaries/software-engineer-salary-SRCH_KO0,17.htm or for one city at /Salaries/new-york-city-software-engineer-salary-SRCH_IL.0,13_IM615_KO14,31.htm.

Keeping your web scraper within Glassdoor's terms

Glassdoor's Terms of Use list scraping, stripping, or mining data from the site without express written permission among the things users agree not to do. Collect data only from pages a logged-out visitor can see, and leave anything behind the sign-in overlay alone.

Space your requests out so you aren't loading pages faster than a person would. If you need high volumes or data that sits behind a login, ask Glassdoor about access before you build for it. The guide to whether web scraping is legal covers the general rules.

Use cases for scraping Glassdoor

Glassdoor is a job board and a review site in one, so what you do with the data depends on which pages you scrape.

Job market research

Job scraping on a schedule shows you which roles companies are hiring for, where those openings are, and how the mix shifts over time. Each card carries a job ID, so you can tell a new posting from one you've already stored and see how long listings stay up.

Salary benchmarking

Salary estimates on job cards and salary pages let you compare pay for the same role across cities, or check an offer against the posted range. Each figure is labeled either "Employer provided" or "Glassdoor est.", and since one comes from the employer and the other is Glassdoor's own estimate, keep the label with the number.

Company sentiment analysis

Review titles, star ratings, and the pros and cons text let you track how employees see company culture over time, and set one employer's company ratings against its competitors' for competitive analysis.

The reviewer field also says whether the person is a current or former employee and what their role is, so you can split sentiment by team.

Sales prospecting and lead generation

Job listings also work as a hiring signal for B2B sales. A company posting several openings for call center representatives is a better lead for call center software than a name on a bought list, because the openings show the need. Scraping listings by role and location gives you the companies hiring in your market right now.

How to scrape Glassdoor job listings with Puppeteer

Puppeteer can scrape Glassdoor job data from your own machine, with no account or proxy. That holds on a home connection. From a cloud server or CI runner, the job search page returns the Cloudflare challenge too, and you'll need the Browserless setup later in this guide.

The scraper collects the first page of software engineer job listings in New York and saves them to a CSV file, and each step adds one part of a single file, glassdoor-puppeteer.js.

Step 1: Install the dependencies

The steps assume basic knowledge of JavaScript and Node.js. You'll need Node.js 22.12 or later, which current Puppeteer requires, and three packages.

  • Puppeteer drives a local Chrome to load the page.
  • Cheerio parses the returned HTML with CSS selectors.
  • csv-writer writes the results to a CSV file.

Install them in a new project folder.

npm install puppeteer cheerio csv-writer

Step 2: Load the job listings page

fetchJobsHtml launches headless Chrome, opens the search URL, and returns the page's HTML once the job cards are in it.

const puppeteer = require("puppeteer");

const jobUrl =
  "https://www.glassdoor.com/Job/new-york-software-engineer-jobs-SRCH_IL.0,8_IC1132348_KO9,26.htm";

async function fetchJobsHtml(url) {
  const browser = await puppeteer.launch({ headless: true });
  try {
    const page = await browser.newPage();

    // Headless Chrome reports itself as "HeadlessChrome", which Glassdoor
    // answers with a 403. Send the browser's own user agent without that word.
    const userAgent = (await browser.userAgent()).replace(
      "HeadlessChrome",
      "Chrome",
    );
    await page.setUserAgent({ userAgent });

    await page.goto(url, { waitUntil: "domcontentloaded", timeout: 60000 });
    await page.waitForSelector('[data-test="jobListing"]', { timeout: 30000 });

    return await page.content();
  } finally {
    await browser.close();
  }
}

With Puppeteer's default user agent, or with a hard-coded string from an older Chrome release, Glassdoor returns its "Security | Glassdoor" page instead of the listings. Deriving the string from browser.userAgent() keeps the Chrome version in it matching the browser that's actually running.

Waiting for [data-test="jobListing"] instead of a network-idle event means the function returns as soon as the cards exist. If Glassdoor serves a block page, the wait times out and throws, and the finally block still closes the browser.

Step 3: Parse the job cards with Cheerio

Glassdoor's class names end in a build hash, such as JobCard_jobTitle__g4YnZ, and that hash changes with each front-end release. The data-test attributes on the job cards stay the same, so extractJobListings selects on those.

Glassdoor job search results with one job card outlined and its job-title, emp-location, and detailSalary data-test elements boxed

You can check a selector before you rely on it. Open the search page in Chrome, then run document.querySelectorAll('[data-test="jobListing"]').length in the DevTools Console tab, and you should get 30.

const cheerio = require("cheerio");

function extractJobListings(html) {
  const $ = cheerio.load(html);
  const jobs = [];

  $('[data-test="jobListing"]').each((_, card) => {
    const $card = $(card);
    const jobTitle = $card.find('[data-test="job-title"]').text().trim();
    if (!jobTitle) return;

    jobs.push({
      jobTitle,
      // The company name has no data-test attribute, so match the stable
      // part of its class name and ignore the hash Glassdoor appends.
      companyName: $card
        .find('[class*="EmployerProfile_compactEmployerName"]')
        .text()
        .trim(),
      location: $card.find('[data-test="emp-location"]').text().trim(),
      salary: $card.find('[data-test="detailSalary"]').text().trim(),
      description: $card
        .find('[data-test="descSnippet"]')
        .text()
        .replace("…", "")
        .replace(/\s+/g, " ")
        .trim(),
      jobId: $card.attr("data-jobid") ?? "",
    });
  });

  return jobs;
}

Each card yields six data points, the job title, company, location, salary estimate, description snippet, and Glassdoor's job ID. The description cleanup removes a stray … entity that Glassdoor leaves in the snippet text, then collapses its line breaks into single spaces.

Step 4: Save the results to a CSV file

The last block writes the jobs data to glassdoor_jobs.csv and runs the three functions in order.

const { createObjectCsvWriter } = require("csv-writer");

async function saveToCsv(jobs, path) {
  const writer = createObjectCsvWriter({
    path,
    header: [
      { id: "jobTitle", title: "Job Title" },
      { id: "companyName", title: "Company" },
      { id: "location", title: "Location" },
      { id: "salary", title: "Salary" },
      { id: "description", title: "Description" },
      { id: "jobId", title: "Job ID" },
    ],
  });
  await writer.writeRecords(jobs);
}

(async () => {
  try {
    const html = await fetchJobsHtml(jobUrl);
    const jobs = extractJobListings(html);
    if (jobs.length === 0) {
      throw new Error(
        "No job cards found. Check whether Glassdoor served a block page.",
      );
    }

    await saveToCsv(jobs, "glassdoor_jobs.csv");
    console.log(`Saved ${jobs.length} jobs to glassdoor_jobs.csv`);
  } catch (error) {
    console.error("Scrape failed:", error.message);
    process.exitCode = 1;
  }
})();

When you run it with node glassdoor-puppeteer.js, it saves 30 jobs to a CSV that spreadsheets and analytics tools open directly, which took about three seconds per run in testing.

The empty-result check stops the script from writing an empty file and reporting success when the page loaded without any cards.

Where a local Glassdoor scraper stops

The job listings scraper works from a home connection. Company data and larger runs are where Glassdoor's anti-bot measures catch up with it.

Cloudflare on company and review pages

Company overview and review pages answer a local Puppeteer browser with a Cloudflare challenge page titled "Just a moment...". In testing, the challenge didn't clear in headless or headful mode, even with the user agent fix from Step 2.

Glassdoor's Cloudflare challenge page with the "Humans only" heading and the Turnstile "Verify you are human" check boxed

Rate limits and IP bans

Every request from a local scraper comes from the same IP address. Request rate is one of the signals bot detection watches, so an address that loads pages too fast can get flagged and keep receiving the 403 page.

When you get a 403 or 429 response, pause and retry later with a growing delay, instead of sending the same request again right away.

Scaling past one browser

One local Chrome is enough for a page of listings. Running dozens of them in parallel means handling memory, crashed browsers, and a proxy pool, which is the self-managed browser infrastructure a hosted web scraping tool takes off your hands.

How to scrape Glassdoor company data with Browserless

Browserless runs the browser for you in the cloud, so the requests no longer come from your own IP address. The examples here use the TypeScript SDK for the Browser Automation Protocol (BAP), Browserless's protocol for driving its hosted browsers from code. Each BAP call compiles down to BrowserQL, the GraphQL API underneath it.

Two BAP calls and a retry loop handle what stopped the Puppeteer scraper. page.proxy() routes the session through a US residential proxy, and page.solve() completes the Cloudflare challenge on company pages through Browserless's CAPTCHA solving. Every retry opens a new session with a new IP address.

Flowchart of how the BAP scraper loads a Glassdoor page: load through a US residential proxy, read the page directly if there is no 403, solve the Cloudflare challenge if there is, and retry on a new session if the solve fails.

Step 1: Install the SDK and set your token

The scraper is a single TypeScript file, glassdoor-bap.mts. Node.js 22.18 or later runs it directly with no build step, and on older versions npx tsx glassdoor-bap.mts does the same job.

The BAP SDK needs npm 11.10 or later. Install it alongside Cheerio and csv-writer.

npm install @browserless.io/bap-ts cheerio csv-writer

Copy your API key from the Browserless dashboard and export it as BROWSERLESS_TOKEN, so it stays out of your code.

export BROWSERLESS_TOKEN="your-api-key"

Step 2: Connect and load a page through a residential proxy

loadPage opens a new BAP page, sets the proxy, loads the URL, and returns the HTML once a selector you choose is present.

import Browserless from "@browserless.io/bap-ts";
import * as cheerio from "cheerio";
import { createObjectCsvWriter } from "csv-writer";
import { writeFile } from "node:fs/promises";

const browser = Browserless.connect({
  browserWSEndpoint: "wss://production-sfo.browserless.io/chromium/bql",
  token: process.env.BROWSERLESS_TOKEN,
  timeout: 120000,
});

async function loadPage(
  url: string,
  readySelector: string,
  attempts = 3,
): Promise<string> {
  for (let attempt = 1; ; attempt++) {
    // Each new page is a new session, so a retry also gets a new proxy IP.
    const page = await browser.newPage();
    try {
      await page.proxy({
        network: "residential",
        country: "US",
        sticky: true,
        type: ["document"],
      });
      const response = await page.goto(url, {
        waitUntil: "domContentLoaded",
        timeout: 60000,
      });

      // Company and review pages answer with a Cloudflare challenge and a 403 first.
      if (response?.status === 403) {
        const result = await page.solve({ type: "cloudflare", timeout: 90000 });
        if (!result.solved) {
          throw new Error(`Cloudflare solve failed: ${result.error ?? "unknown"}`);
        }
      }

      await page.waitForSelector(readySelector, { timeout: 30000 });
      const { html } = await page.html();
      return html ?? "";
    } catch (error) {
      if (attempt >= attempts) throw error;
      console.warn(
        `Attempt ${attempt} failed for ${url}, retrying: ${(error as Error).message}`,
      );
    } finally {
      await page.close();
    }
  }
}

The job search page usually loads with a 200, and the function goes straight to the selector wait. Company and review pages return a 403 with the Cloudflare challenge first, so the function calls page.solve() with the cloudflare type before it waits.

In testing, each solve took between 32 and 58 seconds, which is why the solve timeout is 90 seconds. If the solve times out or reports solved: false, the function throws, and the loop retries on a fresh session, up to three attempts in total. If the solve keeps failing for the pages you target, switch the endpoint to /stealth/bql, Browserless's managed stealth browser.

Step 3: Reuse the job listings parser

The HTML that BAP returns has the same job cards as the Puppeteer version, so the parser doesn't change. Copy extractJobListings from Puppeteer Step 3 and the saveToCsv function (not the async runner below it) from Step 4 into glassdoor-bap.mts, without their require lines, since the import statements at the top of the file already load Cheerio and csv-writer.

Step 4: Extract company details and reviews from JSON-LD

Company pages carry their main figures as schema.org JSON-LD, structured data that Glassdoor embeds in <script type="application/ld+json"> tags for search engines. Reading those blocks gets you the same fields without depending on any class name.

Google's Glassdoor company snapshot with the star rating, rating count, and description boxed and labeled with the JSON-LD fields that hold them

  • EmployerAggregateRating holds the company's star rating and the number of reviews.
  • Organization holds the company name and its description, on the overview page only.
  • Review entries hold each review's title, star rating, reviewer, and pros and cons text.

A Glassdoor employee review card with the reviewer, star rating, and pros and cons text boxed and labeled with their Review JSON-LD fields

extractCompanyData parses every JSON-LD block on the page and picks out those three types.

function extractCompanyData(html: string) {
  const $ = cheerio.load(html);
  const blocks: any[] = [];

  $('script[type="application/ld+json"]').each((_, el) => {
    try {
      blocks.push(JSON.parse($(el).text()));
    } catch {
      // Skip any block that isn't valid JSON.
    }
  });

  const entries = blocks.flat();
  const rating = entries.find((e) => e["@type"] === "EmployerAggregateRating");
  const organization = entries.find((e) => e["@type"] === "Organization");
  if (!rating) {
    throw new Error("No rating data found. The company page may not have loaded.");
  }

  return {
    name: rating.itemReviewed?.name,
    rating: Number(rating.ratingValue),
    reviewCount: Number(rating.ratingCount),
    description: organization?.description?.trim() ?? "",
    reviews: entries
      .filter((e) => e["@type"] === "Review")
      .map((review) => ({
        title: review.name,
        rating: Number(review.reviewRating?.ratingValue),
        reviewer: review.author?.name,
        text: review.reviewBody,
      })),
  };
}

The function throws if it finds no rating block. On a page that didn't load, that's an error you see right away, rather than a JSON file full of undefined values.

Step 5: Run the scraper

The last block loads the job search page and a company overview page, then saves the jobs to a CSV file and the company data to a JSON file.

const jobUrl =
  "https://www.glassdoor.com/Job/new-york-software-engineer-jobs-SRCH_IL.0,8_IC1132348_KO9,26.htm";
const companyUrl =
  "https://www.glassdoor.com/Overview/Working-at-Google-EI_IE9079.htm";

try {
  const jobs = extractJobListings(
    await loadPage(jobUrl, '[data-test="jobListing"]'),
  );
  if (jobs.length === 0) {
    throw new Error(
      "No job cards found. Check whether Glassdoor served a block page.",
    );
  }
  await saveToCsv(jobs, "glassdoor_jobs.csv");
  console.log(`Saved ${jobs.length} jobs to glassdoor_jobs.csv`);

  const company = extractCompanyData(
    await loadPage(companyUrl, 'script[type="application/ld+json"]'),
  );
  await writeFile("glassdoor_company.json", JSON.stringify(company, null, 2));
  console.log(
    `${company.name}: ${company.rating} stars from ${company.reviewCount} reviews, ` +
      `${company.reviews.length} reviews saved to glassdoor_company.json`,
  );
} catch (error) {
  console.error("Scrape failed:", (error as Error).message);
  process.exitCode = 1;
} finally {
  await browser.close();
}

When you run it with node glassdoor-bap.mts, it prints a line for each file it writes. In testing, each run saved 30 jobs and Google's rating, review count, description, and five reviews, and took 40 seconds to two minutes, most of it spent on the Cloudflare solve.

The reviews come back as plain text with the pros and cons labeled, so one review from testing listed its pros as "pay, work life balance, culture, benefits". That format is ready for keyword counts or a sentiment model without any HTML cleanup.

To scrape Glassdoor reviews instead of the overview, point companyUrl at a reviews page such as https://www.glassdoor.com/Reviews/Google-Reviews-E9079.htm. The same parser returns the rating, the review count, and the three reviews a logged-out visitor can see, with an empty description, because reviews pages don't include the Organization block.

For specific company data across a list of employers, loop over their overview URLs and write the results to separate JSON files. Run the loop one company at a time with a pause between them, so the scraper stays at a person's browsing pace. Each successful solve costs 10 units on top of browser time, so a run across 100 company pages adds about 1,000 units.

Conclusion

Once a Glassdoor page loads, reading it is the easy part. Job cards carry data-test attributes, company pages carry their ratings and reviews as JSON-LD, and neither changes when Glassdoor ships a new front end. That's why the scripts in this guide keep working when the class names around them change.

Getting the page to load is where your time goes. Job searches work from your own machine once the user agent is fixed, but company pages never cleared the Cloudflare challenge in a local browser during testing. Browserless runs each page behind a residential proxy and solves the challenge in the same session, so your time goes into the data you came for instead. To run the BAP script on the companies you're tracking, sign up for Browserless.

Glassdoor scraping FAQs

What data can I scrape from Glassdoor?

Logged-out pages give you job listings with the title, company, location, salary estimate, and job ID, plus each company's star rating, review count, description, and a few recent reviews with their star ratings and pros and cons text. Interview reviews have their own pages, such as /Interview/Google-Interview-Questions-E9079.htm, which returned the same 403 page as the company pages in testing, so they need the BAP setup too. Full review histories sit behind the sign-in overlay, which this guide leaves alone.

Can I scrape salaries from Glassdoor?

Yes. Every job card carries a salary estimate labeled "Employer provided" or "Glassdoor est.", and both scrapers in this guide already save it. Salary pages for a job title, such as /Salaries/software-engineer-salary-SRCH_KO0,17.htm, loaded through Browserless with the residential proxy in testing, and you can parse them with the same loadPage helper once you've picked selectors for the fields you need.

Will Glassdoor block my scraper?

It will if the scraper looks automated. Glassdoor returned a 403 to headless Puppeteer's default user agent and to a hard-coded older Chrome string, and it puts company and review pages behind a Cloudflare challenge. A matching user agent, a residential IP address, a solve step on challenge pages, and a slow request rate got the test runs in this guide through, but none of that makes a scraper undetectable.

Scraping publicly visible pages is common practice, and the guardrails for Glassdoor are the same as for any site. Its Terms of Use ask that you don't scrape without written permission, so read them before you start, stay on pages a logged-out visitor can see, keep your request rate modest, and don't collect anything behind the sign-in overlay. For a commercial project or large volumes, ask Glassdoor about access or check with a lawyer first.

Can I get sued for leaving or scraping a bad review on Glassdoor?

Posting a review carries defamation risk when it states something false as fact about a real person or company, not when it gives an opinion, which is the same standard that applies to any review site. Scraping reviews other people have already posted is a different activity, since you're collecting public text instead of publishing claims, and the guardrails in the previous answer cover it. Neither answer is legal advice for your situation.