Get Selected Element HTML
webscraping_ai_selectedExtract the HTML of the first page element that matches a CSS selector from any URL, with optional JavaScript rendering and proxy settings.
Instructions
Get the HTML of the first page element matching a CSS selector. API docs: https://webscraping.ai/docs#selected
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"url": "<url>",
"selector": "<selector>"
},
"name": "webscraping_ai_selected"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| js | No | Execute on-page JavaScript using a headless browser (false by default). | |
| url | Yes | URL of the target page. | |
| proxy | No | Type of proxy: datacenter, residential, or stealth (datacenter by default). Residential and stealth requests cost more than datacenter — see the pricing page. | datacenter |
| device | No | Type of device emulation. | |
| format | No | Response format (json or text). | json |
| country | No | Country of the proxy to use (US by default). | |
| timeout | No | Maximum web page retrieval time in ms (20000 by default, maximum is 30000). | |
| selector | Yes | CSS selector to extract content for. | |
| wait_for | No | CSS selector to wait for before returning the page content. | |
| js_script | No | Custom JavaScript code to execute on the target page. | |
| js_timeout | No | Maximum JavaScript rendering time in ms (3000 by default). | |
| custom_proxy | No | Your own proxy URL in "http://user:password@host:port" format. | |
| error_on_404 | No | Return error on 404 HTTP status on the target page (false by default). | |
| error_on_redirect | No | Return error on redirect on the target page (false by default). |