Skip to main content

api-interception Scenario 2 — Wait for API Search Response and Parse

Written by RTILA X Engineering Team

Beginner ~4 min

What You'll Learn

Wait for network responses matching a URL pattern

Real-World Use Case

Capturing paginated API data

LIVE DEMO

API Search Demo

Trigger a search and wait for the /api/v2/search response.

EXPECTED OUTPUT

Search Results

title url snippet
Wireless Noise-Cancelling Headphones /scenarios/ecommerce/product/1 Premium over-ear headphones with active noise cancellation and 30-hour battery life.
Wireless Charging Pad /scenarios/ecommerce/product/7 15W fast wireless charging pad with slim aluminum design and LED indicator.
Bluetooth Speaker /scenarios/ecommerce/product/8 Waterproof portable speaker with 360° sound and 20-hour battery.
Wireless mouse setup guide /learn/selectors-guide Step-by-step guide for reliable selectors and wireless automation profiles.
Wireless sensor network basics /learn/advanced-patterns Understanding the core concepts behind modern wireless sensor networks and automation.
RTILA X PROJECT JSON

RTILA X Automation Project

intercept-api-search.json
    {
  "name": "Intercept_API_Search",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/api-interception/2"
    ],
    "headless": false,
    "navigation_timeout": 30000,
    "max_concurrent_workers": 1,
    "humanoidEnabled": true,
    "humanoidSensitivity": "medium"
  },
  "datasets": {
    "search_results": {
      "item_selector": "css=.api-search-result",
      "properties": [
        {
          "name": "title",
          "type": "text",
          "selector": "css=.api-result-title"
        },
        {
          "name": "snippet",
          "type": "text",
          "selector": "css=.api-result-snippet"
        }
      ]
    }
  },
  "commands": [
    {
      "command": "goto",
      "params": {
        "url": "https://learn.rtila.com/scenarios/api-interception/2"
      }
    },
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=#api-search-input"
      }
    },
    {
      "command": "fill",
      "params": {
        "selector": "css=#api-search-input",
        "value": "web scraping"
      }
    },
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=#api-search-btn"
      }
    },
    {
      "command": "click",
      "params": {
        "selector": "css=#api-search-btn"
      }
    },
    {
      "command": "wait_for_api_response",
      "params": {
        "url_pattern": "/api/v2/search"
      }
    },
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=.api-search-result"
      }
    },
    {
      "command": "extract_data",
      "params": {
        "dataset": "search_results"
      }
    }
  ]
}
  

Search-as-you-type interfaces may rely on API endpoints. The wait_for_api_response command waits for the matching search request before extracting the results from the DOM.

Did you complete this scenario?

Ready to run this automation?

Copy the project JSON above, open RTILA X, create a new project, and paste it.

This scenario covers 1 RTILA X command and is referenced in 1 learning article.

Continue Learning

Was this helpful?