loadState
The loadState action loads cookies and localStorage from a state file into the open site. The file comes from saveState, or from Playwright’s storageState. For the whole pattern, see Sign in once and reuse the session.
For comprehensive options, see the
loadStatereference.
What it loads
loadState applies only what fits the open page:
- the cookies whose domain is the open host or a parent of it;
- the
localStorageentries saved for the open origin.
Open the site with goTo before loadState. Then goTo again, so the app reads the loaded state:
Formats
String format
A path ending in .json. A relative path resolves against outputDir, where saveState writes by default.