20 of the best prompts for browser automation, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.

20 of the best prompts for browser automation, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.
Published June 27, 2026
Getting Browser Automation right takes more than a single prompt. This 4-stage guide covers Setup Environment, Write Automation Scripts, Testing and Debugging, and more, breaking the whole process into focused steps where each prompt builds on the last. Automating browser tasks can be tedious and error-prone without clear guidance. These prompts streamline the process of setting up, executing, and troubleshooting browser automation scripts, making them accessible for users of various skill levels. Every prompt is optimized and runs in ChatGPT, Claude, and Gemini.
Before you can automate browser tasks, you need to ensure your development environment is configured correctly. These prompts help you establish the necessary tools and dependencies.
Install browser automation framework
"I need to install a browser automation framework for [PROGRAMMING LANGUAGE]. I am setting up my development environment to automate tasks for a project involving [PROJECT DESCRIPTION]. Please provide a step-by-step installation guide for [FRAMEWORK NAME] on [OPERATING SYSTEM], including any dependencies I need to install. List the installation steps in a numbered format, and specify any configuration settings required. If there are compatibility issues with certain versions, note those separately."
Configure browser settings
"I need to configure browser settings for [BROWSER NAME] to ensure compatibility with my automation scripts. This is crucial for avoiding issues like pop-up blockers interfering with tasks and managing cookies effectively. Please provide a step-by-step guide that includes adjustments for pop-up blockers, cookie settings, and necessary extensions. Aim for at least five specific steps in a clear, numbered format. If there are any settings that could potentially conflict with automation, note those separately for further review."
Set up project structure
"I am starting a new browser automation project and need to establish an organized folder structure. This project will help streamline my tasks and improve efficiency. Please suggest a detailed directory layout that includes folders for [PLACEHOLDER ITEMS LIKE SCRIPTS, DATA, LOGS, CONFIG]. I need at least five distinct folders and a brief description of the purpose for each one. If there are any common best practices for naming conventions, note those separately."
Create initial script template
"I need to create a basic template for a browser automation script using [FRAMEWORK NAME]. This script will help me automate repetitive tasks in my workflow. Please include essential sections such as initialization, action steps, and error handling, with placeholders for [PLACEHOLDER VARIABLES]. Structure the output to have three main sections, and ensure each section contains at least two lines of code. If any section is not applicable, note it separately for review."
Install necessary browser drivers
"I need to install the browser drivers for [BROWSER NAME] to work with [FRAMEWORK NAME]. This is essential for automating tasks effectively in my development environment. Please provide a step-by-step guide for downloading the appropriate driver, including the exact location where it should be placed in my project directory. Ensure the steps are clear and concise, ideally in a numbered format. If there are compatibility issues or alternative drivers available, note those separately."
Creating automation scripts requires a clear understanding of the tasks you want to automate. These prompts guide you in writing effective scripts for various use cases.
Automate login process
I need to write a script that automates the login process for [WEBSITE NAME]. This script should help streamline my access to the site by inputting the username and password automatically. Please include the necessary steps to enter these credentials: [PASTE CREDENTIALS]. The output should be a clear, step-by-step script in [PROGRAMMING LANGUAGE] format, with comments explaining each part. If any error occurs during the login attempt, ensure the script captures and logs the error message for review.
Scrape data from a webpage
"I need to create a script that scrapes data from [WEBSITE URL], as I'm looking to automate data collection for [SPECIFIC PURPOSE]. I want to extract the following elements: [PASTE ELEMENTS]. Please provide a code snippet that captures this data in a structured format, such as a CSV or JSON file. Ensure that the script is capable of handling pagination if applicable. Additionally, if any elements are missing or inaccessible, note them separately for further review."
Fill out a web form
"I need to write a script to automate filling out a form on [WEBPAGE URL]. The form includes fields such as [PASTE FIELDS], and I want the script to submit the completed form. Please provide a sample code snippet that demonstrates how to fill each field with example data. Ensure the code is structured clearly and includes comments for each step. If any field is optional, note it separately to avoid errors during form submission."
Navigate through multiple pages
"I need to create a script that navigates through multiple pages on [WEBSITE NAME] to automate data collection. My goal is to click through links on the site and gather information on [PASTE DATA]. Outline the steps for the script to follow, ensuring it captures at least [NUMBER] data points from each page in a structured format, such as a table or list. If a page fails to load, note the URL separately for troubleshooting."
Handle alerts and pop-ups
"I need to write a script that handles alerts and pop-ups on [WEBSITE NAME]. This script should automate the process of accepting, dismissing, or retrieving text from alerts that may appear during my browsing session. Please include the necessary code snippets and comments for clarity. Output the script in a structured format with clear sections for each action: accept, dismiss, and retrieve text. If there are any specific error messages that might occur, note them separately for debugging purposes."
Testing and debugging are critical to ensure your automation scripts work correctly. These prompts help you identify issues and optimize your scripts.
Test script for functionality
"I need to test the functionality of my automation script for [TASK], which is crucial for ensuring that the script performs as intended. To do this, I will follow these steps: [PASTE STEPS]. Please provide a detailed checklist of at least five items to verify that it runs correctly, including potential issues to watch for. Additionally, if I encounter any unexpected errors, note them separately for further investigation."
Debug script errors
"I am troubleshooting an error in my browser automation script, which is crucial for [PROJECT NAME]. The error message I received is: [ERROR MESSAGE]. Please help me identify potential causes and solutions by providing a list of at least five common issues and their corresponding fixes. Present the solutions in a clear, step-by-step format. Additionally, if the error is related to a specific library or framework, note that separately for further investigation."
Optimize script performance
"I need to optimize my automation script for [TASK], which is intended to enhance efficiency in my workflow. I am currently facing performance issues, including slow load times and high resource consumption. Please provide a list of at least five actionable tips to improve performance, focusing on areas such as reducing load times and minimizing resource usage. If there are any specific tools or techniques that could be beneficial, note them separately."
Log script outputs
"I need to implement logging in my automation script for [FRAMEWORK NAME]. This is important because it will help me identify issues and optimize my scripts effectively. Please provide a code example that captures key events, such as [PASTE EVENTS], and outputs them to a log file. I need at least three distinct logging levels: error, warning, and info, formatted as a list. If any logging level fails, note it separately for further investigation."
Implement error handling
"I need to implement error handling in my automation script for [TASK] to ensure it runs smoothly and can handle unexpected issues. I would like to include a strategy for catching errors and a sample code snippet that demonstrates this implementation. Please provide a list of three error handling strategies, along with code examples for each. Additionally, if there are any specific error types that should be prioritized, note them separately."
Once your scripts are functioning, you need to think about deployment and ongoing maintenance. These prompts guide you in deploying your automation solution effectively.
Schedule script execution
"I need to schedule my automation script to run at specific intervals for [PURPOSE]. I have tested the script and confirmed it works as intended, but now I need to automate its execution using [SCHEDULING TOOL OR METHOD]. Please provide a step-by-step guide outlining the setup process. Include any necessary configurations and commands. Additionally, ensure to note any potential issues that may arise during scheduling and how to troubleshoot them if they occur."
Deploy script to production
"I need to deploy my browser automation script to a production environment to streamline [PASTE TASK]. My script has been tested, and now I want to ensure it runs smoothly. Please outline the steps I need to take, including any necessary configurations, monitoring tools, and error handling procedures. Present this in a numbered list with at least five detailed steps. If there are any potential risks during deployment, note them separately for further evaluation."
Update scripts for website changes
"I need to update my automation script for the website [WEBSITE NAME] due to recent changes that affect its functionality. The current script is designed to perform [PASTE TASKS], but I’ve noticed issues with [PASTE SPECIFIC ELEMENTS]. Please provide a step-by-step process for adjusting the script, including any necessary code snippets or adjustments. Ensure the output includes three specific areas that require updates. If the changes affect the script's overall performance, note those separately for further review."
Monitor script performance
"I need to monitor the performance of my running automation scripts to ensure they are functioning optimally. I am looking for tools or techniques that can help me track their performance and detect any issues that may arise. Please provide a list of [PASTE TOOLS OR TECHNIQUES] that can be used for this purpose. Include at least five items, formatted as bullet points. Additionally, flag any tools that require significant setup time or may complicate the monitoring process."
Document script functionality
"I need to create documentation for my automation scripts that I have developed for [PROJECT NAME]. This documentation is intended to help other users understand the functionality and usage of the scripts. Please include key sections such as an overview, installation instructions, usage examples, and troubleshooting tips. Format this into a clear and concise document with bullet points where appropriate. If there are any areas that are unclear, note them separately for further clarification."
Browser automation refers to the use of software to control a web browser programmatically. This allows users to automate repetitive tasks, such as testing web applications or scraping data.
Some popular frameworks for browser automation include Selenium, Puppeteer, and Playwright. Each has its own features and is suited for different use cases.
To handle dynamic content, ensure your scripts wait for elements to load before interacting with them. Use techniques like explicit waits or wait conditions to manage timing.
While browser automation itself is legal, it is important to consider the terms of service of the websites you are automating. Always ensure compliance with legal guidelines and site policies.
If your script stops working, check for changes on the website that may affect element locators or functionality. Debugging the script and reviewing logs can help identify the issue.
AI Prompts for Resolving Conflicting API Routes
Lovable may generate API endpoints or page routes that conflict with existing ones, causing unexpected behavior in your application.
See promptsAI Prompts for Eliminating Unnecessary Abstraction Layers
Lovable creates wrapper functions or utility layers for logic used only once, causing unnecessary complexity.
See promptsAI Prompts for Managing Context Window Limits
Bolt runs out of context mid-task, causing it to lose progress on large codebases.
See prompts