Overview
The Go Back step simulates clicking the browser’s back button, navigating to the previous page in the browser history. Use it to test back navigation, return to previous pages after actions, or verify that browser history works correctly.When to Use Go Back
Use Go Back when you need to:- Test back navigation: Verify the back button works correctly in your app
- Return after submission: Go back after completing a form or action
- Test multi-step workflows: Navigate backward through multi-page processes
- Verify state preservation: Check that page state is preserved when returning
- Test browser history: Ensure your single-page app correctly manages history
How It Works
Go Back navigates to the previous page in the browser’s history stack, just like clicking the browser’s back button. It triggers a full page navigation (or client-side routing for SPAs), returning to the exact state the previous page was in. Important: Go Back requires there to be a previous page in the browser history. If your test starts on a page with no previous history, Go Back will have no effect.Real-World Examples
Returning After Form Submission
Testing Multi-Step Workflow Navigation
Verifying Single-Page App History
Testing State After Back Navigation
Best Practices
Ensure History Exists
- Don’t use Go Back as the first step in a test
- Navigate to at least one page before using Go Back
- Verify there’s a previous page in history
- Consider using Navigate if you need to go to a specific URL
Wait After Navigation
- Add Wait for Element after Go Back
- Wait for key page elements to appear
- Account for page load time
- Handle loading states appropriately
Verify the Result
Always check that back navigation worked:- Use Check URL to verify the correct page loaded
- Use Check Visibility to verify page content appeared
- Use Check Text to verify preserved state
Test State Preservation
Check what should and shouldn’t persist:- Form data might be preserved (browser-dependent)
- Scroll position might be restored
- Dynamic content might need reloading
- Test both client-side and server-rendered pages
Troubleshooting
Nothing Happens
Symptom: Go Back step runs but page doesn’t change Solution:- Verify there’s a previous page in browser history
- Check that your test navigated to at least one page before Go Back
- Use Navigate instead if you need to go to a specific URL
- Add Wait for Element to ensure navigation completes
Wrong Page Appears
Symptom: Go Back navigates to an unexpected page Solution:- Review your test flow to understand the history stack
- Check if redirects added unexpected history entries
- Verify SPA routing is managing history correctly
- Use Check URL to confirm the destination
State Lost After Back
Symptom: Form data or page state is lost when going back Solution:- This is often browser-dependent behavior
- Some frameworks don’t preserve state on back navigation
- Test manually to confirm the expected behavior
- Consider if state should actually persist
SPA Navigation Issues
Symptom: Back navigation doesn’t work in single-page app Solution:- Verify your SPA framework manages browser history correctly
- Check that client-side routing pushes history states
- Ensure back navigation triggers proper route changes
- Test with and without JavaScript to isolate the issue
Related Steps
- Navigate - Navigate to a specific URL
- Reload - Refresh the current page
- Check URL - Verify the page after going back
- Wait for Element - Wait for content after navigation

