loadCookie
The loadCookie action loads a cookie from a file or environment variable into the browser. This action is useful for restoring authentication sessions, user preferences, or other stateful information that was previously saved using the saveCookie action.
For comprehensive options, see the
loadCookiereference.
Use cases
- Session restoration: Load previously saved authentication cookies to skip login steps
- Test setup optimization: Reduce test execution time by reusing authentication state
- Cross-test data sharing: Share cookies between different test specifications
- CI/CD integration: Load authentication state from environment variables in automated pipelines
- Test isolation: Ensure consistent starting state by loading known cookie values
- Multi-user testing: Load different user sessions for testing various user roles
Formats
The loadCookie action supports multiple formats:
String format
Load a cookie by name from default location or by file path:
Load from environment variable
Load from file
Object format
Load a cookie with detailed configuration:
Configuration options
Examples
Load from default location
Load from specific file
Load from environment variable
Load with domain filtering
Complete workflow example
Related actions
saveCookie: Save a browser cookie to a file or environment variableloadVariables: Load environment variables from .env files