For AI agents: a documentation index is available at /llms.txt
Skip to main content

Automate Google Search

Navigate to Google, submit a search query, and extract result titles and links.

Prerequisites

Steps

Use the /scrape REST endpoint to extract Google search results. No WebSocket connection needed.

note

Google actively blocks automated requests. The /scrape endpoint has no stealth capabilities, so results may be empty or return a CAPTCHA page. The BQL tab uses BrowserQL's built-in stealth and CAPTCHA solving. Use it for more reliable results.

View Full Code on GitHub

1. Build the request

Pass the query directly in the URL and use the /scrape endpoint to extract headings from the results page:

https://production-sfo.browserless.io/scrape?token=YOUR_API_TOKEN_HERE

2. Send the request

curl -X POST \
"https://production-sfo.browserless.io/scrape?token=YOUR_API_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.google.com/search?q=Browserless+headless+browser",
"elements": [{ "selector": "h3" }]
}'

3. Check the output

Each entry in results includes the text, HTML, dimensions, and position of the matched element:

{
"data": [
{
"results": [
{
"attributes": [{ "name": "class", "value": "..." }],
"height": 48,
"html": "Browserless | Headless Browser Automation & Scraping",
"left": 180,
"text": "Browserless | Headless Browser Automation & Scraping",
"top": 320,
"width": 600
},
{
"attributes": [{ "name": "class", "value": "..." }],
"height": 48,
"html": "Getting Started | Browserless",
"left": 180,
"text": "Getting Started | Browserless",
"top": 420,
"width": 600
}
],
"selector": "h3"
}
]
}

Next steps