CoursePart 0 — The On-RampLesson 0.3
Lesson 0.3Part 0 — The On-Ramp

What a website is made of

You click a button — what actually happens behind the scenes?

Lesson 0.3of 24
Next

Step 1

The idea

01

Think of a restaurant. There are two worlds:

Front of house — the dining room, the menu, the waiter, the plates. This is what the customer sees and touches.

Back of house (the kitchen) — the chefs, the ovens, the ingredients, the orders. The customer never sees this, but everything depends on it.

A website works exactly the same way. The front is what you see. The back is what runs when you click something.

Step 2

See it run

02

Let's walk through exactly what happens when you click "Add to Cart" on Amazon:

1. You click the button

Your browser sends a message to Amazon's servers: 'User 48291 wants to add item B09XYZ to cart.'

2. The server receives the request

Amazon's backend code runs. It checks if the item is in stock, if you're logged in, and calculates the price.

3. The database is updated

Your cart record in Amazon's database is updated to include the new item.

4. The server sends a response

Amazon's server sends back a message: 'Done. Cart now has 3 items.'

5. Your browser updates the page

The cart icon in the corner changes from 2 to 3. You see the confirmation.

All of that happens in under a second. And every single step is something a tester might need to check.

Step 3

Now you try

03

Open any website — this one, Google, YouTube, anything. Then right-click on the page and click "Inspect" (or press F12).

What you'll see:

  • • A panel with lots of colourful code — that's the HTML (the structure of the page)
  • • Hover over any HTML line — it highlights part of the page
  • • That's the exact element Playwright will click, fill, or read in a test
💡Tip
You just opened DevTools — a browser built-in tool that every web developer and QA engineer uses daily. You're already using professional tools.

Step 4

Why a tester cares

04

Playwright controls the front of house — the part users see. It opens a browser, finds elements in the HTML, and interacts with them exactly like a user would.

add-to-cart.spec.js
// Find the "Add to Cart" button on the page
await page.getByRole('button', { name: 'Add to Cart' }).click();

// Check that the cart count updated
await expect(page.getByLabel('Cart items')).toContainText('3');

Understanding what a website is made of helps you understand why Playwright works the way it does. It's finding and clicking real HTML elements — the same ones the user sees.

Recap

3 key points
  • 1Websites have a front (HTML/CSS/JS the user sees) and a back (servers/databases the user doesn't see).
  • 2When you click something, a chain of events fires — request → server → database → response → UI update.
  • 3Playwright tests the front — it controls a real browser and interacts with real HTML elements.