
Explore Playwright with Python for web automation testing, starting with Python fundamentals and Playwright basics to help you build your own automation framework using the pytest-playwright library.
Download and install Python 3.9.5, accepting the license, on Mac or Windows. Verify by opening Terminal or Command Prompt and typing python or python3 to confirm Python 3.9.5.
Install PyCharm IDE by downloading from JetBrains, choose the community version, and install on macOS Apple Silicon or Intel, or Windows; complete setup and allow app access.
Seek feedback to improve course quality and instructor performance, inviting private messages or Q&A posts to refine content for current and future students.
Python fundamentals files
Create a Python file named first_program, write a simple print statement with quotes, then run the program to display Hello world and personalize it with your name, e.g., Hello Simon.
Learn to use Python comments to skip lines and document code, including inline and mid-line notes, and toggle them with the command forward slash shortcut to reveal or hide code.
Explore strings, integers, and floats in Playwright with Python for web automation testing, showing how quotes define strings, how integers perform math, and how floats handle decimal numbers.
Master Python variable naming conventions: use snake_case with alpha characters, digits, and underscores; avoid camel case; ensure variables start with a letter to improve readability.
Learn how to prompt for user input with the Python input() function, store it in a username variable, and print a friendly greeting using strings and variable formatting.
Explore converting numeric strings to integers with int and back to strings with str to perform math on string values, handle user input, and avoid type errors.
Explore booleans and comparisons in Python, using ==, !=, >, <, >=, and <= to evaluate numbers and strings. Learn about case sensitivity, UTF-8 representations, and assigning boolean values.
Explore Python conditional statements using if, booleans, and indentation to execute code only when criteria are met; see blocks run or skip, with basic error handling for invalid input.
Learn how elif statements control Python conditional logic, selecting the first true condition in an if-elif-else chain and skipping the rest, while avoiding consecutive ifs and unintended truths.
Master Python lists as flexible containers holding multiple values, including mixed types and nested lists, and learn key operations like index, reverse, pop, append, count, and membership tests.
Explore tuples in Python, a data type like lists that stays immutable, defined with parentheses, and that holds data types including lists or tuples, changing only by reassigning the tuple.
Master Python for loops by iterating over strings, ranges, and lists, printing results with f-strings, and embedding if statements for conditional logic.
Define functions with def, name them, and reuse code by calling the function to execute it; print is a function, and functions run as many times as you call them.
Learn how to return values from Python functions, assign results to variables, and unpack multiple returns using tuples with simple examples like sum and product.
Declare parameter and return types with Python function annotations, explore int, string, list, and None examples, and see how PyCharm highlights expected types to aid code comprehension.
Explore Python classes as blueprints for creating reusable objects, exposing properties and methods, using dot notation to access attributes, and preparing for the init constructor in object oriented programming.
Learn to create and reuse Python modules, import functions, variables, and classes, and use module and function aliases to call code from other files.
Explore Python packages as folders of modules, learn how to create a package with __init__.py, and use package.module imports while refactoring paths for better organization.
Explore the standard Python library and its importable modules, using math for the square root and string utilities to manipulate text; see PyCharm auto-import.
Playwright offers cross-browser web automation with Chrome, Firefox, and Safari, supports device emulation, reusable login storage, browser contexts for parallel users, and powerful network interception and selector options.
Install playwright in a new virtual environment in PyCharm and use playwright install to grab pre-packaged browsers, including Chromium, WebKit, and a nightly image for Safari, for web automation testing.
Discover how Playwright's test generator records actions into Python code, generates a Chromium-based test, and uses the inspector to adapt selectors and implement network idle waits.
Use pause to stop the script before a page loads, inspect with the continue or debug options, then step over actions, and record steps to quickly create new tests.
Add an assertion with expect to verify the login button disappears after login, and optionally verify the username appears, using a network idle wait for reliable page load.
Use slow_mo to slow down Playwright tests for debugging and demonstration by setting 500 milliseconds, revealing elements like a dropdown, while noting the trade-off of longer test duration.
Configure default and per-element timeouts in Playwright with Python for web automation testing. Learn to set timeouts for click, fill, and expect checks, including 3 seconds and 15 seconds defaults.
Learn the latest Playwright locator strategies, using get by role, get by test ID, and get by label, with insights on accessibility and code generator support.
Master text locators in playwright with Python, using get by text, get by role, and text equals with exact matches. Compare page get by text with locator, and explore XPath.
Chain selectors in Playwright with Python to traverse the dom with xpath, ascend to a parent, then extract text from an h3 tag to verify the item is shoes.
https://playwright.dev/python/docs/other-locators#css-matching-elements-based-on-layout
Use the all() method in Playwright with Python to collect all matching links as a list. Iterate, check text for $85, and ensure socks are not present with lowercase text.
Spin up your automation framework from scratch in a matter of days! It's super fast with Python and pytest.
Then comes Playwright with its nitrogen-fast browser test execution! We are going to blend Playwright capabilities into the pytest framework with the use of markers, fixtures, CLI commands.
In this course we will cover:
Python basics
Playwright
Pytest
project structure
page object model
reporting
parallel execution
create our own pytest fixtures for set_up and tear_down methods
utilize existing Playwright fixtures
deploy our test to CI/CD using GitHub Actions
Learn yml syntax
Store login passwords securely as GitHub Secrets
Perform Visual Testing like a pro
Why Playwright?
Playwright enables fast, reliable and capable testing and automation across all modern browsers.
Support for all browsers
Test on Chromium, Firefox and WebKit. Playwright has full API coverage for all modern browsers, including Google Chrome and Microsoft Edge (with Chromium), Apple Safari (with WebKit) and Mozilla Firefox. Test can run in headful and headless modes
Fast and reliable execution
By fast I mean REALLY fast!
Auto-wait APIs. Playwright interactions auto-wait for elements to be ready. This improves reliability and simplifies test authoring.
Fast isolation with browser contexts. Reuse a single browser instance for multiple isolated execution environments with browser contexts.
Resilient element selectors. Playwright can rely on user-facing strings, like text content and accessibility labels to select elements.
Multiple domains, pages and frames. Playwright is an out-of-process automation driver that is not limited by the scope of in-page JavaScript execution and can automate scenarios with multiple pages.