Skip to main content
Glama

extract_after_click

Extract content from web pages by first clicking an element to reveal dynamic content, then scraping specified elements for development workflows.

Instructions

Click an element and extract content from another element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to scrape
clickSelectorYesCSS selector of element to click
extractSelectorYesCSS selector of element to extract

Implementation Reference

  • Core handler implementation: Navigates to the URL using Playwright, clicks the specified element, waits for the target element to appear, extracts its text content, and returns it.
    async extractAfterClick(config: ScrapingConfig, clickSelector: string, extractSelector: string): Promise<string> { const browser = await this.getBrowser(); const page = await browser.newPage(); try { await page.goto(config.url, { waitUntil: 'networkidle', timeout: config.timeout || 30000, }); await page.click(clickSelector); await page.waitForTimeout(1000); await page.waitForSelector(extractSelector, { timeout: config.waitForTimeout || 10000, }); const text = await page.textContent(extractSelector); return text || ''; } finally { await page.close(); } }
  • Dispatcher handler case: Parses input parameters and calls the DynamicScraper.extractAfterClick method.
    case 'extract_after_click': { const clickSelector = params.clickSelector as string; const extractSelector = params.extractSelector as string; const content = await dynamicScraper.extractAfterClick(config, clickSelector, extractSelector); return { content }; }
  • Input schema defining the parameters: url, clickSelector, and extractSelector.
    inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL to scrape', }, clickSelector: { type: 'string', description: 'CSS selector of element to click', }, extractSelector: { type: 'string', description: 'CSS selector of element to extract', }, }, required: ['url', 'clickSelector', 'extractSelector'], },
  • Tool registration in the webScrapingTools array, including name, description, and input schema.
    { name: 'extract_after_click', description: 'Click an element and extract content from another element', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL to scrape', }, clickSelector: { type: 'string', description: 'CSS selector of element to click', }, extractSelector: { type: 'string', description: 'CSS selector of element to extract', }, }, required: ['url', 'clickSelector', 'extractSelector'], }, },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/code-alchemist01/development-tools-mcp-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server