CoursePart 1 — JavaScript for PlaywrightLesson 1.1
Lesson 1.1Part 1 — JavaScript for Playwright

What is JavaScript?

What JavaScript is, where it runs, and what Node.js has to do with it.

Lesson 1.1of 24
Next

Step 1

The idea

01

Think of a website as a puppet show. There are three people involved:

  • HTMLbuilds the puppet — the structure (head, arms, body).
  • CSSdresses the puppet — colours, size, costume.
  • JavaScriptis the puppeteer — makes it move, react, and do things when the audience interacts.

JavaScript (JS) is the programming language of the web. It runs inside browsers — but with Node.js, it also runs on your computer directly, outside any browser. That's how Playwright works: Node.js runs your test scripts on your machine.

Step 2

See it run

02

Here's the output first:

Output
JavaScript is running on my computer!

And the file that produces it:

intro.js
console.log("JavaScript is running on my computer!");

Run it with:

Terminal
$ node intro.js

That's Node.js reading your file and executing it. No browser needed.

Step 3

Now you try

03

Create a file called intro.js in your playwright-course folder, paste the code above, and run it.

Then change the message inside the quotes to anything you like and run it again.

🎉Win!
If you see your message in the terminal — Node.js is working and you just ran your first JavaScript file.

Step 4

Why a tester cares

04

Node.js lets JavaScript do things beyond the browser — read files, make network requests, run scripts automatically. Here's a simple example: printing a personalised message using Node.js on your computer.

greet.js
const name = "Priya";
const tool = "Node.js";

console.log(`Hello ${name}! You're running JavaScript with ${tool}.`);
console.log("No browser needed — just the terminal.");
Terminal
$ node greet.js

This is exactly the kind of script automation engineers write — not web pages, but programs that run and do things. Playwright is just a much more powerful version of this idea.

Recap

3 key points
  • 1JavaScript is the language that makes web pages interactive — and Playwright tests are written in it.
  • 2Node.js lets JavaScript run on your computer (not just in a browser).
  • 3Every Playwright test is a .js (or .ts) file that Node.js executes.