Advanced web scraping solution using n8n, Selenium, and GPT-4o Vision. This powerful n8n workflow handles logins, anti-bot measures, and sophisticated data extraction from complex websites.
Download this n8n workflow template and start using it instantly.
This is the ultimate scraping solution built entirely within an n8n workflow. Traditional web scraping often fails against modern anti-bot measures and complex JavaScript rendering. This n8n workflow bypasses these issues by using a dedicated Selenium Chrome container configured for stealth. It is triggered by an n8n trigger (Webhook) and can handle two main scenarios: searching for a relevant URL via Google or scraping a predefined Target Url. Crucially, it supports injecting session cookies for authenticated scraping (e.g., pages requiring login). Instead of fragile CSS selectors, the workflow takes a screenshot and uses the OpenAI GPT-4o Vision n8n node to visually analyze the page and extract the requested data fields, making the process highly resilient and accurate. This complex n8n workflow ensures high success rates even on challenging targets.
The n8n workflow begins with a POST request received by the Webhook n8n trigger.
If Target Url n8n node directs execution to perform a Google Search (Google search Query) scoped to the provided domain to find the best page URL (Extract First Url Match). An AI Information Extractor then validates the best URL.Create Selenium Session) via HTTP requests to a local Selenium Docker service (selenium_chrome:4444). The session is configured with anti-detection arguments.If n8n node checks for incoming cookies. If present, a Code n8n node processes the cookies (standardizing sameSite values), and the Inject Cookie n8n node uploads them to the Selenium browser session for authenticated access.Get ScreenShot). This image is converted to binary data by the Convert to File n8n node.OpenAI n8n node receives the image and a specific prompt. It analyzes the screenshot to determine if the site is blocked (returning 'BLOCK') or to extract the required data. This provides a resilient alternative to standard HTML parsing.Information Extractor n8n node, which structures the data precisely according to the user's defined Target data schema.Success), and multiple Delete Session HTTP Request n8n nodes ensure that the Selenium resource is always gracefully terminated, regardless of success or failure throughout the n8n workflow execution.To deploy this advanced n8n workflow, several external dependencies are required in addition to importing the JSON:
OpenAI API connection used by the AI n8n node configurations.http://selenium_chrome:4444. You must deploy the associated Docker Compose file (refer to the GitHub project linked in the sticky note). Ensure your n8n container can communicate with the Selenium container.--proxy-server=address:port) to the Create Selenium Session n8n node's JSON body. Note that Selenium often requires IP whitelisting for proxy authentication.Webhook n8n node.This complex n8n workflow utilizes core logic, HTTP requests for browser control, and advanced AI integration:
Webhook (n8n trigger): The starting point for the n8n workflow, configured to receive POST requests carrying all necessary scraping parameters (URL, subject, cookies, target data).
Create Selenium Session (HTTP Request n8n node): Initiates a headless Chrome session. Key settings include anti-detection arguments and a connection timeout.
Code (n8n node): A custom scripting n8n node used specifically to normalize incoming cookie sameSite attributes to values accepted by Selenium ('Strict', 'Lax', 'None').
Inject Cookie (HTTP Request n8n node): Posts the structured cookie JSON data to the active Selenium session to bypass login pages.
If nodes (If Target Url, If, etc.): These If n8n nodes manage flow control, checking for the presence of input cookies or a target URL to ensure the n8n workflow follows the correct path.
Get ScreenShot (HTTP Request n8n node): Instructs the Selenium browser to capture the fully rendered webpage as a base64 encoded image.
Convert to File (n8n node): Converts the base64 screenshot output into a binary format suitable for OpenAI's Vision API.
OpenAI / OpenAI1 (OpenAI n8n node): Performs image analysis using GPT-4o Vision. The prompt is highly specialized, asking the AI to extract specific data from the screenshot or return a 'BLOCK' signal if a WAF or anti-bot screen is detected.
Information Extractor (LangChain n8n node): This highly specialized AI n8n node takes the unstructured text summary from GPT-4o and strictly formats it into the specific, named fields requested by the user's Target data input, ensuring structured and usable JSON output. This is a critical piece of the n8n template for data processing.
Delete Session (HTTP Request n8n node): Multiple cleanup nodes, crucial for resource management, ensuring the Selenium browser session is terminated after the n8n workflow completes, even on error paths.
Automate end-to-end content creation, from Airtable input to WordPress publishing, using a powerful n8n workflow leveraging OpenAI, RankMath SEO, and image generation. Get this n8n template now!

Deploy a comprehensive n8n workflow AI agent powered by GPT, RAG (Pinecone), Gmail, and Notion tools. Automate scheduling, email management, and data retrieval instantly from Telegram.

Automate UX interview analysis using this powerful n8n workflow. Transcribe MP3s via OpenAI, summarize user needs and pain points, and export structured data directly to Google Sheets.

Use this robust n8n workflow template to automatically enrich contact data by checking for LinkedIn User profile data first, and falling back to Organization data using the Unipile API. Perfect for maximizing data quality in your n8n automation.

Orchestrate business tasks using this advanced n8n workflow. Integrates Telegram, Google Gemini, and Notion to manage projects, sales, content, and scheduling via voice or text input.








































