saveCookie
The saveCookie action saves a browser cookie to a file or environment variable for later reuse. This action is useful for preserving authentication sessions, user preferences, or other stateful information between test runs or across different tests.
Reload saved cookies with the loadCookie action.
For comprehensive options, see the
saveCookiereference.
Use cases
- Session persistence: Save authentication cookies to maintain login state across test runs
- Multi-step workflows: Preserve cookies between different test specifications
- Cross-browser testing: Transfer cookies between different browser contexts
- CI/CD integration: Store authentication state as environment variables for automated testing
- Test data management: Save cookies to files for debugging and test data inspection
Formats
The saveCookie action supports multiple formats:
String format
Save a cookie by name to a default location:
Save to environment variable
Save to file
Object format
Save a cookie with detailed configuration:
Configuration options
Examples
Save to default location
Save to specific file
Save to environment variable
Save with domain filtering
Related actions
loadCookie: Load a saved cookie back into the browserloadVariables: Load environment variables from .env files