Overview
Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
Learn how to use Playwright's APIRequestContext class in Python for making HTTP API requests without loading a full browser. Discover the core methods including .get(), .post(), .put(), and .delete() for sending HTTP requests, and understand how to create request contexts using p.request.new_context(). Explore practical applications such as sending direct requests to API endpoints, testing APIs quickly and efficiently, and integrating API tests with UI tests. Follow a step-by-step approach covering context creation, making API calls, handling responses, and proper context disposal. Work through hands-on examples including GET requests to retrieve user data and POST requests to create new resources using the reqres.in API. Master response handling techniques including status code checking, JSON parsing, and accessing response data in various formats (text, bytes, and Python dictionaries). Understand how to integrate with pytest-playwright plugin for streamlined test setup and teardown, and learn best practices for API testing automation using Playwright's powerful request context functionality.
Syllabus
Playwright Python 9 | API Request Context
Taught by
Automation Step by Step