Skip to main content

Overview

The Check URL step verifies that the current browser URL matches your expected pattern. It’s essential for testing navigation flows, confirming redirects work correctly, and ensuring users land on the right pages after actions.

When to Use Check URL

Use Check URL when you need to:
  • Verify navigation works: Confirm clicking links or buttons takes users to the correct pages
  • Test redirects: Ensure login flows, payment completions, or error handlers redirect appropriately
  • Check dynamic URLs: Validate URLs with user IDs, order numbers, or other dynamic parameters
  • Confirm single-page app routing: Test that client-side routing updates URLs correctly
  • Validate query parameters: Check that search filters, pagination, or state parameters appear in the URL

How It Works

Check URL reads the current browser URL and compares it against your expected pattern. It supports three matching strategies: exact matches (the URL must be identical), partial matches (the URL must contain your pattern), and regex matches (for complex dynamic URL structures). Unlike other verification steps that check page content, Check URL focuses solely on the address bar. This makes it perfect for testing navigation, routing, and redirect logic without needing to inspect page elements.

Using the Check URL Step

When you add a Check URL step, you’ll configure:

Specifying Your Expected URL

Check URL gives you three ways to define what URL you’re expecting: Static URL or Pattern Type the URL or pattern directly. You can use exact URLs, partial paths, or regex patterns depending on what you need to verify. Environment Variables Reference environment-specific URLs using {{VARIABLE_NAME}} syntax. Perfect for tests that run across staging and production environments with different base URLs. Variables from Previous Steps Toggle “Use variables” to select URLs you captured or generated earlier in your test. This appears when you’ve used steps like Extract Value, Run Python, or API Request. Ideal for verifying dynamic redirects or generated links.

Choosing Your Matching Strategy

The way Check URL interprets your pattern depends on what you provide: Exact Match: When you provide a complete URL like https://example.com/dashboard, Check URL verifies the browser URL matches exactly. Partial Match: When you provide just a path like /dashboard, Check URL verifies that path appears anywhere in the URL. Regex Match: When you provide a regex pattern like ^https://example\.com/user/\d+$, Check URL uses pattern matching for complex validation.

Real-World Examples

Confirming Successful Login Redirect

Step 1: Navigate
  URL: https://example.com/login

Step 2: Fill
  Locator: input[name='email']
  Text: {{TEST_USER_EMAIL}}

Step 3: Fill
  Locator: input[name='password']
  Text: {{TEST_USER_PASSWORD}}

Step 4: Click
  Locator: button[type='submit']

Step 5: Check URL
  Pattern: /dashboard
Why this works: After logging in, verify users land on the dashboard.

Validating Dynamic User Profile URLs

Step 1: Click
  Locator: a[href*='/profile']

Step 2: Check URL
  Pattern: ^https://example\.com/user/\d+/profile$
Why this works: Use regex to verify URLs with dynamic user IDs follow the expected format.

Environment-Aware URL Testing

Step 1: Click
  Locator: button[data-action='checkout']

Step 2: Check URL
  Pattern: {{BASE_URL}}/checkout/payment
Why this works: Test redirects across different environments using environment variables.

Verifying Search Query Parameters

Step 1: Fill
  Locator: input[name='search']
  Text: laptop

Step 2: Click
  Locator: button[type='submit']

Step 3: Check URL
  Pattern: ?query=laptop
Why this works: Confirm search parameters appear in the URL correctly.

Testing Redirect After Form Submission

Step 1: Extract Value
  Locator: .order-confirmation-number
  Variable Name: orderNumber

Step 2: Click
  Locator: a[data-action='view-order']

Step 3: Check URL
  Use variables: orderNumber
Why this works: Capture a dynamic value and verify the redirect includes it in the URL.

Confirming Error Page Navigation

Step 1: Navigate
  URL: https://example.com/invalid-page-404

Step 2: Check URL
  Pattern: /error/404
Why this works: Verify error handling redirects to the correct error page.

Best Practices

Choose the Right Matching Strategy

  • Use exact matches for specific page verification: https://example.com/success
  • Use partial matches for path verification: /checkout/complete
  • Use regex patterns for dynamic components: ^https://example\.com/order/[0-9A-Z]+$

Handle Environment Differences

  • Store base URLs in environment variables: {{BASE_URL}}
  • Test the same flow across staging and production
  • Keep environment-specific configuration out of your test steps

Account for URL Variations

  • Remember trailing slashes: /dashboard vs /dashboard/
  • Consider protocol differences: http:// vs https://
  • Watch for URL encoding in query parameters
  • Account for query parameter order variations

Write Clear Regex Patterns

When using regex:
  • Escape special characters: \. for literal dots
  • Use \d+ for numeric IDs
  • Use [0-9A-Z]+ for alphanumeric codes
  • Test your patterns with an online regex validator first

Troubleshooting

URL Doesn’t Match

Symptom: Test fails saying URL doesn’t match pattern Solution:
  • Check for trailing slashes (they must match exactly)
  • Verify protocol matches (http vs https)
  • Look for case sensitivity differences
  • Check if query parameters or hash fragments affect the match

Environment Variable Not Working

Symptom: Pattern shows {{VARIABLE_NAME}} literally instead of substituting the value Solution:
  • Verify the variable is defined in your environment settings
  • Check the variable name matches exactly (case-sensitive)
  • Confirm you’re using the correct double-curly-brace syntax

Regex Pattern Issues

Symptom: Regex pattern doesn’t match when it should Solution:
  • Escape special regex characters in URLs (\. for dots)
  • Test your regex pattern with an online validator
  • Account for URL encoding (%20 for spaces, etc.)
  • Remember that partial patterns might match unexpectedly

Dynamic URL Components

Symptom: URLs with session IDs or timestamps fail pattern matching Solution:
  • Use regex patterns to match dynamic parts: /session/[a-z0-9]+
  • Consider partial matches if only part of the URL matters: /checkout
  • Extract and use variables for truly dynamic validation

Single-Page App Routing

Symptom: URL changes but Check URL runs before routing completes Solution:
  • Add a Wait for Element step to ensure page content loads
  • Check URL after waiting for a page-specific element
  • Account for hash-based routing (#/dashboard) vs path-based routing
  • Navigate - Navigate to URLs before verification
  • Extract Value - Extract URLs or dynamic values to verify later
  • Wait for Element - Wait for page load after navigation
  • Click - Trigger navigation that you want to verify