Skip to content

Extractors & Boundary Extraction

ASM's automatic field detection configures most dynamic fields for you: session cookies, CSRF tokens, OAuth Bearer tokens. But occasionally ASM misses a field. Worse, it sometimes configures fields that shouldn't be dynamic, causing replay failures.

Extractors are the mechanism ASM uses to grab values from server responses. Understanding how they work lets you create custom ones when ASM misses fields and disable unneeded ones when ASM over-configures.

This guide covers when to create custom extractors, how to configure them step by step, and how to fix common extractor problems.


What Extractors Do

The Extraction-Assignment Flow

Every dynamic field has two parts:

  1. Extraction: Grab value from server response
  2. Assignment: Use extracted value in subsequent request

Example flow:

1. Server response: Set-Cookie: sessionId=abc123
   → Extractor captures "abc123"
   → Stored in user state variable "sessionId"

2. Next request: Cookie: sessionId=abc123
   → Field "sessionId" reads from user state variable
   → Sends fresh extracted value

Without extractor: Field uses hardcoded value from recording → Replay fails (session expired).

With extractor: Field uses fresh value from server → Replay succeeds.

Extractors vs. Field Configuration

Extractor = How to grab the value from response

Field configuration = Where to use the extracted value in request

Both must work together:

  • ✅ Extractor configured + Field configured = Dynamic field works
  • ❌ Extractor configured + Field NOT configured = Value extracted but never used
  • ❌ Extractor NOT configured + Field configured = Field has no fresh value, uses hardcoded

When ASM Creates Extractors Automatically

Built-In Extraction Rules

ASM's 300+ detection rules create extractors automatically for common patterns:

Automatically extracted:

  • Session cookies: From Set-Cookie headers
  • CSRF tokens: From HTML hidden <input> fields
  • OAuth Bearer tokens: From JSON access_token fields
  • ASP.NET ViewState: From __VIEWSTATE hidden field
  • Standard form fields: Hidden inputs with predictable patterns

Check Actors View after ASM runs:

  1. Select page in Navigator
  2. Click Actors tab at bottom
  3. Choose Extractors from dropdown
  4. See extractors ASM created automatically

Grey-background extractors = ASM auto-configured ✅

No extractors listed = ASM didn't detect dynamic values on this page

When Manual Extractors Are Needed

Create custom extractor when:

  1. ASM missed a dynamic field: Field shows white background in Fields View, replay fails
  2. Application uses non-standard patterns: Custom JavaScript assignment, unusual formats
  3. Value embedded in complex HTML/JSON: ASM's boundary extraction can't find it
  4. Multiple related values: Need to extract field name AND value (dynamic field names)

Symptoms requiring custom extractor:

  • ✅ Replay fails with errors about missing/invalid field values
  • ✅ Fields View shows field as "Recorded" (not grey background)
  • ✅ Manual inspection shows value in response but ASM didn't extract it
  • ✅ Extractor error messages during replay

Ask the AI

My replay fails with an error about "account_id" field. I can see the
value in the server response but ASM didn't configure it. How do I
create a custom extractor for this field?

Extractor Types

1. String Delimited Extractor (Boundary Extraction)

Use when: Value appears between predictable prefix and suffix strings.

How it works: Specify text before value (prefix) and text after value (suffix). Extractor captures everything between them.

Example HTML:

<input type="hidden" name="transactionId" value="12345" />

Configuration:

  • Prefix: name="transactionId" value="
  • Suffix: "
  • Extracted value: 12345

This is the most common extractor type. Simple and reliable when prefix/suffix are predictable.

2. Regular Expression Extractor

Use when: Boundary extraction isn't precise enough, or pattern is complex.

How it works: Regular expression with capture groups. Each (...) captures a value.

Example JavaScript:

onclick="send_back('Accounts','c8f7a0b2-4e1d-8a9c-5f3e-2b1a9c8d7e6f')"

Configuration:

  • Pattern: send_back\('Accounts','([0-9a-f-]+)'\)
  • Captured value: c8f7a0b2-4e1d-8a9c-5f3e-2b1a9c8d7e6f (capture group 1)

When to use regex over boundary:

  • ✅ Prefix/suffix too vague (would match multiple values)
  • ✅ Need pattern matching (e.g., "any hex string")
  • ✅ Value format needs validation
  • ✅ Multiple values in same pattern (multi-variable extractor)

3. Multi-Variable Extractor

Use when: Need to extract multiple values from single pattern (e.g., field name AND value).

How it works: Regex with multiple capture groups. Each group extracts to separate variable.

Example HTML:

Item45=Widget
Item56=Gadget

Problem: Field name is dynamic (Item45 vs Item56). Need to extract both name and value.

Configuration:

  • Pattern: (Item\d+)=(\w+) (two capture groups)
  • Variable 1: fieldName (captures Item45)
  • Variable 2: fieldValue (captures Widget)

Result: Both field name and value extracted, assigned to separate variables.


Creating a Custom Extractor: Step-by-Step

The Problem: ASM Missed a Field

Scenario: Recording a CRM system, creating contacts with accounts.

Symptom: Replay succeeds but contact associated with wrong account.

Investigation:

  1. Open Fields View: See all configured fields
  2. Find account_name: Configured correctly (grey background)
  3. Find account_id: NOT configured (white background, no icon)

Root cause: The application posts the account name (visible) but also posts an internal ID (hex string). ASM configured the name but missed the ID.

Step 1: Find the Value in Response

Use Grep tool to search:

  1. Select page where account is chosen
  2. View response content in Content View
  3. Search for the field value you saw in Fields View

Example: Search for hex string c8f7a0b2-4e1d-8a9c-5f3e-2b1a9c8d7e6f

Found in:

<a onclick="send_back('Accounts','c8f7a0b2-4e1d-8a9c-5f3e-2b1a9c8d7e6f')">Account 7</a>

Now you know:

  • ✅ Value appears in onclick handler
  • ✅ It's in send_back() JavaScript function
  • ✅ Surrounded by single quotes

Step 2: Create the Extractor

  1. Select page in Navigator (the page containing the value)
  2. Click Actors tab at bottom
  3. Choose Extractors from dropdown
  4. Click green plus (+) to add new extractor
  5. Extractor dialog appears

Create Extractor dialog

Step 3: Configure String Delimited Extractor

In Create Extractor dialog:

  1. Extractor Type: String Delimited (default)
  2. Prefix: send_back('Accounts','
  3. Text immediately before the value you want
  4. Include quotes, punctuation exactly as they appear
  5. Suffix: ')
  6. Text immediately after the value
  7. Variable Name: account_id
  8. Name for user state variable (will store extracted value)
  9. Match field name for clarity

Verify extraction:

  • Extracted Value box shows: c8f7a0b2-4e1d-8a9c-5f3e-2b1a9c8d7e6f
  • Content preview highlights extraction in blue ✅

Click OK to save extractor.

Step 4: Assign Extracted Value to Field

Now connect the extractor to the field:

  1. Open Fields View (bottom tab)
  2. Find account_id field (the one that wasn't configured)
  3. Double-click field to open configuration dialog
  4. Change Value source:
  5. From: Text Constant (hardcoded)
  6. To: User Variable
  7. Enter variable name: account_id
  8. Must match variable name from extractor
  9. Click OK

Result: Field now shows grey background with icon, configured ✅

Step 5: Test with Replay

  1. Right-click test caseReplay
  2. Watch for errors in Errors View
  3. Check result: Contact should associate with correct account
  4. Verify in Headers View:
  5. Click transaction that posts account_id
  6. Check POST data shows fresh extracted value (not hardcoded)

If replay succeeds: Extractor working correctly ✅

If replay still fails: Check troubleshooting section below.

Extraction Flow Complete

You've created a custom extractor (captures value) and assigned it to a field (uses value). The dynamic field now works like ASM auto-configured fields.


Multi-Variable Extractors: Name AND Value

The Problem: Dynamic Field Names

Some applications use dynamic field names, where the field NAME changes, not just the value.

Example:

Recording:  Item45=Widget
Replay:     Item56=Gadget  ← Field NAME changed (Item45 → Item56)

Standard extractor fails: Looks for Item45 in replay, can't find it (now called Item56).

Solution: Multi-variable extractor that captures both name and value.

Step 1: Disable ASM for These Fields

First, stop ASM from trying to configure them:

  1. Right-click test caseConfigure → Application State...
  2. Check "Expert Options"
  3. Select "Guided Configuration"
  4. ASM wizard runs → Shows field list
  5. Select problem fields (e.g., Item45, Item56)
  6. Select "Never Extract" radio button
  7. Icon changes: ASM will skip these fields

Why: ASM's automatic extraction can't handle dynamic names. You'll configure manually.

Step 2: Create Multi-Variable Extractor

  1. Select page containing the fields
  2. Actors tab → Extractors → Add (+)
  3. Extractor Type: Regular Expressions
  4. Enter regex pattern with multiple capture groups:

Example pattern:

(Item\d+)=(\w+)

Explanation:

  • (Item\d+): Capture group 1, "Item" followed by digits (the field name)
  • =: Literal equals sign
  • (\w+): Capture group 2, word characters (the field value)

Configuration:

  • Pattern: (Item\d+)=(\w+)
  • Instance: 1 (extract first match)
  • Variable Names: itemName itemValue (space-separated, one per capture group)

Verify:

  • Variable 1 (itemName): Shows Item45
  • Variable 2 (itemValue): Shows Widget
  • Content highlights both extractions in blue

For multiple items: Create additional extractors with instance 2, 3, etc. (or copy/paste and change instance number).

Step 3: Configure Field with Dynamic Name

  1. Open Fields View
  2. Find field (e.g., Item45)
  3. Double-click field
  4. Configure VALUE:
  5. Value source: User Variable
  6. Variable name: itemValue
  7. Click Name tab (important!)
  8. Configure NAME:
  9. Name source: User Variable
  10. Variable name: itemName
  11. Click OK

Result: Both field name and value are dynamic, extracted fresh on each replay.

Testing Dynamic Names

Run replay with different data:

  • Recording: Item45=Widget
  • Replay 1: Item56=Gadget (different name and value)
  • Replay 2: Item99=Gizmo (different again)

Extractor behavior:

  1. Extract name: Item56 → stored in itemName
  2. Extract value: Gadget → stored in itemValue
  3. Post field: Item56=Gadget (both dynamic)

If working correctly: Field name and value match what server sent ✅

Multi-Variable Help

I need to extract both the field name and value from a dynamic field.
The pattern is like "Item45=Widget" where both Item45 and Widget change
every session. How do I create a multi-variable extractor for this?

Disabling Unneeded Extractors

The Problem: ASM Over-Configures Fields

Sometimes ASM creates extractors for fields that don't actually change: static values that happen to look dynamic.

Consequences:

  • Wasted memory: Every configured field consumes memory during load tests
  • Parsing errors: If page layout varies, extractor can't find value, and replay fails
  • Cluttered Fields View: Hard to find fields that matter

Example: Application has browserId=chrome in every URL. Value never changes, but ASM configured it as dynamic.

Finding Over-Configured Fields

Indicators a field shouldn't be configured:

  1. Value never changes: Same in recording and all replays
  2. Static parameter: Application always uses same value (e.g., version=2.0, lang=en)
  3. Client-side constant: JavaScript hardcodes value, doesn't come from server

Check Fields View:

  • Look for fields with same value in every transaction
  • Check Datasource: If it shows extractor but value is static, likely over-configured

Disabling Extractors: Multi-Select Workflow

The fast way (recommended):

  1. Select test case in Navigator
  2. Open Fields View (click Fields tab at bottom)
  3. Multi-select fields you want to disable:
  4. Click first field
  5. Hold Ctrl/Cmd and click additional fields
  6. All selected fields highlighted
  7. Right-click selectionEdit
  8. Datasource dropdown: Select Text Constant
  9. Click OK

Result: All selected fields changed to static (use recorded value, no extraction).

Benefits:

  • Faster than editing one at a time
  • Prevents future re-configuration: If you re-run ASM, these fields stay static
  • Immediate: No need to re-run ASM

When to Use Text Constant

Set field to Text Constant when:

  • ✅ Value never changes across recordings/replays
  • ✅ Application documentation says value is static
  • ✅ Field is application version, language code, or similar constant
  • ✅ Extractor causes parsing errors due to page variation

Don't use Text Constant if:

  • ❌ Value might change in future (dynamic user data)
  • ❌ You're not certain it's static (test with multiple replays first)
  • ❌ Server generates the value (even if currently same)

Alternative: Add to Auto-Ignore List

For fields that appear in many test cases:

Instead of disabling manually in each test case, add to global auto-ignore list:

  1. Window → Preferences → Web Performance → Configuration Wizards → Ignored Fields
  2. Add field name to Ignored Names list
  3. Future ASM runs will skip this field automatically

See Auto-Ignore & Equivalent Fields for details.


Extractor Best Practices

1. Let ASM Create Extractors First

Always run ASM before creating manual extractors.

Workflow:

  1. ✅ Record test case
  2. ✅ Run ASM (automatic or manual)
  3. ✅ Run replay to see if it works
  4. Only create custom extractors if replay fails

Why: ASM handles 95% of fields automatically. Don't spend time manually configuring what ASM already did.

2. Use String Delimited Unless Regex Required

String Delimited extractors are:

  • ✅ Simpler to configure (no regex knowledge needed)
  • ✅ More readable (clear prefix/suffix)
  • ✅ Less error-prone (no regex escaping issues)

Use Regex only when:

  • ❌ Prefix/suffix too vague (would match wrong values)
  • ❌ Pattern validation needed (e.g., must be hex format)
  • ❌ Multiple capture groups required (multi-variable)

3. Make Prefix/Suffix Specific

Bad prefix (too vague):

Prefix: value="
→ Matches EVERY value="" attribute in HTML

Good prefix (specific):

Prefix: <input name="transactionId" value="
→ Matches only transactionId field

Include enough context to make prefix/suffix unique within the page.

4. Test Extractors with Multiple Responses

Create extractorVerify with test:

  1. Run replay to get fresh response
  2. Check extracted value in Fields View
  3. Run replay again (if possible) with different server data
  4. Verify extractor captures different values correctly

One successful extraction doesn't prove robustness; test with varied responses.

5. Name Variables Clearly

Bad variable name:

var1, temp, x

Good variable name:

account_id, transactionId, sessionToken

Why: You will forget what the variable does. Clear names are a gift to your future self.

Naming convention:

  • Match field name when possible (e.g., account_id variable for account_id field)
  • Use descriptive names for multi-variable extractors (itemName, itemValue)
  • Avoid starting with # (ASM uses that prefix for auto-created variables)

6. Document Complex Extractors

For regex extractors, add comments explaining pattern:

Example (keep notes in external doc):

Extractor: account_id
Pattern: send_back\('Accounts','([0-9a-f-]+)'\)
Purpose: Captures SugarCRM internal account ID (hex UUID format)
Location: onclick handler in account search results

Why: Regex patterns are notoriously hard to understand six months after you wrote them.

7. Use AI to Validate Extractors

After creating extractor, ask AI to verify configuration:

Validate Extractor

I created an extractor with these settings:

Type: String Delimited
Prefix: send_back('Accounts','
Suffix: ')
Variable: account_id

Can you verify this will extract the account ID correctly from this HTML:
<a onclick="send_back('Accounts','c8f7a0b2-4e1d')">Account 7</a>

Troubleshooting Extractors

Problem: Extractor Not Finding Value

Symptoms: Extractor error during replay: "Unable to extract value" or "Pattern not found".

Possible causes:

  1. Prefix/suffix don't match exactly: Extra space, wrong quotes, typo
  2. Value on different page: Extractor configured on wrong page
  3. Response content changed: Server sends different format in replay vs recording
  4. Case sensitivity: Accountaccount

Solutions:

Verify prefix/suffix:

  1. View response content in Content View
  2. Find the value manually (Ctrl+F)
  3. Copy exact text before and after value
  4. Compare to extractor prefix/suffix
  5. Fix any differences (spaces, quotes, case)

Check extractor page:

  • Extractor must be on page that receives the value from server
  • Not the page that sends it: extraction happens on response, not request

Compare recording vs replay:

  • View recorded response (Content View during recording)
  • View replay response (Content View during replay)
  • Check if format changed: Server might send different HTML/JSON in replay

Problem: Wrong Value Extracted

Symptoms: Extractor captures value, but it's the wrong value (matches different field).

Possible cause: Prefix/suffix too vague, matching multiple places in response.

Example:

<input name="userId" value="123" />
<input name="orderId" value="456" />

Bad prefix: value=" → Matches BOTH fields

Good prefix: <input name="userId" value=" → Matches only userId

Solution: Make prefix more specific (include more context).

Problem: Multi-Variable Extractor Missing Variables

Symptoms: Multi-variable extractor configured, but only one variable populated.

Possible causes:

  1. Regex capture groups wrong: Not enough (...) groups
  2. Variable names mismatched: Number of names doesn't match capture groups
  3. Instance number wrong: Extracting wrong match

Solutions:

Check capture groups:

  • Pattern: (Item\d+)=(\w+) (TWO capture groups)
  • Variable names: itemName itemValue (TWO names, space-separated)
  • Must match: Same number of groups and names

Test regex online:

  • Use regex tester (regex101.com)
  • Paste response content
  • Verify pattern matches and captures correct groups

Check instance number:

  • If pattern matches multiple times, instance number controls which match
  • Instance 1 = first match, Instance 2 = second match, etc.

Problem: Extractor Works in Recording, Fails in Replay

Symptoms: Extractor extracts value during recording, but fails during replay.

Possible causes:

  1. Server sends different format: HTML structure changed
  2. Value appears in different location: Moved to different page
  3. Conditional content: Value only appears for certain users/states

Solutions:

Compare response content:

  1. View recording response (from original recording session)
  2. View replay response (from failed replay)
  3. Look for differences: Extra/missing elements, changed attribute order

Check if value moved:

  • Search entire test case for the value
  • May have moved to earlier or later page in replay
  • Extractor on wrong page for replay data

Handle conditional content:

  • If value doesn't always appear, extractor will fail when missing
  • May need conditional logic or error handling (contact support for complex cases)

Problem: Extractor Causes Performance Issues

Symptoms: Load test slower after adding many extractors.

Possible cause: Too many extractors configured, or regex extractors with complex patterns.

Impact:

  • Each extractor parses response content
  • Regex extractors slower than string delimited
  • Hundreds of extractors can impact performance

Solutions:

Disable unneeded extractors:

  • Set to Text Constant if value doesn't actually change
  • See "Disabling Unneeded Extractors" above

Use string delimited when possible:

  • Faster than regex
  • Only use regex when boundary extraction insufficient

Optimize regex patterns:

  • Avoid greedy quantifiers (.*)
  • Use specific patterns (\d+ instead of .+)
  • Anchor patterns when possible (^...$)

Troubleshooting Help

My extractor fails with "Pattern not found" during replay. It worked
during recording. The pattern is: send_back('Accounts','

Here's the response content from replay:
[paste content]

What's wrong with my extractor configuration?

Advanced Extractor Techniques

Instance Numbers: Multiple Matches

Problem: Regex pattern matches multiple times in same page.

Example HTML:

<li>Item: <span class="id">100</span></li>
<li>Item: <span class="id">200</span></li>
<li>Item: <span class="id">300</span></li>

Pattern: <span class="id">(\d+)</span> → Matches all three

Instance number controls which match to extract:

  • Instance 1: Extracts 100
  • Instance 2: Extracts 200
  • Instance 3: Extracts 300

Use case: Extract specific item from list (e.g., first, second, or last).

Copy/Paste Extractors for Similar Patterns

Workflow for multiple similar extractions:

  1. Create first extractor (e.g., Instance 1)
  2. Right-click extractor in Extractors view → Copy
  3. Right-click againPaste
  4. Edit pasted extractor:
  5. Change Instance number (2, 3, etc.)
  6. Change Variable name (item1item2)
  7. Repeat for each instance

Much faster than building each extractor from scratch.

Extracting from JSON Responses

JSON responses often need regex extractors (boundary extraction can work but regex more reliable).

Example JSON:

{
  "userId": "12345",
  "sessionToken": "abc123xyz"
}

Extractor configuration:

  • Pattern: "userId":\s*"([^"]+)"
  • Captured value: 12345

Tips for JSON:

  • Account for whitespace with \s* (optional spaces)
  • Use [^"]+ to match anything except quotes (safer than .*)
  • Test pattern with actual JSON response

Extractors in Detection Rules

Once you create a custom extractor that works, you can make it automatic for future test cases by creating a detection rule.

See: Advanced Field Assignments - Custom Detection Rules

Benefit: Future recordings of same application automatically configure this field (no manual extractor needed each time).


Next Steps


Related Topics: