EN
Lesson 4.2Pro - Part of Agentic School Pro

Browser Automation and Scraping: Playwright, Browser Use and the .har Trick

Automate and scrape the web reliably with Playwright, including the non-headless manual-login trick and the .har trick

28 min•Automation and Agentic Systems•Available

What you learn

  • Automating the browser with Playwright and agent-driven browser tools
  • The non-headless manual-login trick for sites behind authentication
  • The .har trick: extracting the real API endpoints behind a page

Summary

Most of the web has no public API, but every site is already an interface a human can drive, which means a program can drive it too. Playwright is the tool that does this: it controls a real browser the way a user would, clicking, typing and reading the page. On top of that sit two tricks that turn fragile scraping into reliable automation. The non-headless trick lets you log in by hand once and reuse the session. The .har trick lets you skip the rendered page entirely and call the API the site itself is calling. This lesson teaches all three, plus when to reach for an agent-driven browser and how to stay on the right side of ethics and the law.

What you will learn

You will learn Playwright basics, how agent-driven browsing (Browser Use and similar) differs from scripted automation, the visible-browser manual-login pattern that sidesteps the hardest part of authenticated sites, and how to record a .har file and let an agent extract the underlying API calls. You will also learn where the legal and ethical lines are and when to hand scale off to a provider like Brightdata.

Prerequisites

Courses 1 to 3 and a working Node project. You should be comfortable with async code, how HTTP requests and headers work, and reading your browser DevTools. The Fundamentals page on what an API is helps if request and response are still fuzzy, because the whole .har trick is about finding the API a page hides.

The problem

You need data or an action from a site that gives you no API. The naive approach is to scrape the rendered HTML with brittle selectors that break the moment the site changes a class name. The harder cases are sites behind a login, with bot detection, or that load everything through JavaScript so the HTML is empty until scripts run. People burn days fighting selectors and login flows when the site is quietly making clean JSON API calls the whole time, visible in DevTools, that they could call directly.

Unlocking your Pro lesson

Comments

Loading comments.

Post a comment
CommentsNext
Next step

Ready to put AI to work as a real workflow?

Start with the foundations course, keep your progress locally and sync everything to your free account whenever you like.