Objective: Plug & chug, ~3 minutes: what methods are, and how to read any line that calls one.
⏱ ≈14 min full lesson · Converted from the O-03 module deck · English edition — Español · العربية · বাংলা in translation
Plug & chug, ~3 minutes: what methods are, and how to read any line that calls one.
Methods are verbs: If properties are a class's nouns, methods are its verbs: goto(), expectLoaded(), field(). You call a method ON an object — po.goto() reads as an instruction: “po — go.”
Inside one method: A method can use the object's own properties — this.page and this.path, the facts from O-02. Verbs act on the object's nouns. That's most of OOP, honestly. Code: async goto() { | await this.page.goto(this.path); | }
Plug & chug: read it as English: po.expectLoaded() → “Home page object: verify you're loaded.” If a line of test code doesn't read like an instruction to someone, it's probably written at the wrong layer. Try: po.field("#g-name") → “Home page object: give me the ______ field.”
You can read po.anything() fluently now. Last OOP stop: the two ways classes share code — and which one this framework prefers.