Playwright
This is a shortened version of the Playwright Page documention with methods that may be most frequently used when testing with GuardianTest.
The Page class provides methods to interact with a tab within a browser instance.
Methods
Returns the result of running a function in the page context.
Usage
You can pass an argument to the function or you can evaluate strings as functions.
Locate elements by their alt text
Usage
Locate elements by their label
, or aria-label
Usage
Locate elements by their placeholder content
Usage
Locate element by the data-testid
Usage
Locate elements that have certain text
Usage
Locate elements that have a certain title attribute
Usage
Navigate to a URL
Usage
This is a very commonly used method in tests. It returns an element locator object that can be used to perform actions on the page
Usage
Provides the ability to modify network requests. Every request matching a URL pattern will stall unless it's continued, fulfilled, or aborted.
Usage
Takes a screenshot
Usage
Events
Emitted when the page calls either console.log
, console.error
, console.warn
, or console.dir
Usage
Last updated