Prompt-Driven Browser Automation: Build Broma Flows Using AI Instructions
Why AI Prompting Is a Game‑Changer for No‑Code Browser Automation
Manual creation of browser automations in tools like Broma often feels like solving a puzzle. You must locate the right element, decide when to wait, and anticipate page changes. The process can take hours for a simple daily task, and even experienced users hit friction when a site redesigns a button or moves a price element.
AI prompting changes that dynamic. By writing a clear, natural‑language description of what you want the browser to do, you hand the problem to an LLM that already knows how to break tasks into discrete steps, choose sensible selectors, and even suggest waiting strategies. The result is a ready‑to‑paste list of actions that you can drop into Broma, saving time and reducing errors.
The Core Idea: Describe, Let AI Build, Refine
The workflow is simple:
- Define the task in plain English – what page, what data, what actions.
- Add context – mention any login state, required pauses, or verification steps.
- Send the prompt to your chosen LLM (ChatGPT, Claude, etc.) or use Broma’s built‑in AI assistant if you have one.
- Review the AI‑generated step list and copy the actions into Broma.
- Test and tweak – adjust selectors or wait times as needed.
This loop lets you focus on the what rather than the how, making automation accessible to operations staff, marketers, and solo operators who are not developers.
Crafting Effective Prompts
A good prompt contains five key ingredients:
- Goal – the end result (e.g., "record the current price of product X").
- Source – the URL or page name where the task runs.
- Actors – any login or authentication details that must be present in a specific browser profile.
- Actions – the sequence of interactions (open, click, type, wait, read, screenshot).
- Checks – assertions or validations (price > 0, element visible, text match).
Example prompt:
I need a Broma flow that runs every morning on the "ShopSmart" product page (https://shopsmart.com/product/12345). The flow should open the page, wait until the price element with class "price-current" is visible, read the numeric value, and write it to a Google Sheet. If the price is missing for more than 5 minutes, send an email alert.
Notice the prompt specifies the page, the selector class, the desired output, and a failure condition. This level of detail guides the LLM to produce a precise step list.
Translating Prompt Into Broma Steps
Once you have the AI‑generated steps, map them to Broma’s visual actions. Below is a typical mapping:
| Prompt Element | Broma Action | Tips |
|---|---|---|
| Open page | Open URL action | Use the exact URL; enable "Load wait" if the page is slow. |
| Wait for element | Wait for element | Choose a selector that is unlikely to change (e.g., a data‑attribute). |
| Click element | Click action | Verify the click coordinates; you can add a small pause after the click. |
| Type text | Type action | Use a stable selector; consider using a JavaScript expression for dynamic values. |
| Read text | Read element text | Capture the text into a variable for later use. |
| Branch / condition | If block | Use a "Read element" action followed by a "If" condition on the extracted value. |
| Loop | Repeat block | Set a maximum iteration count to avoid infinite loops. |
| Screenshot | Take screenshot | Helpful for debugging when a page changes. |
| Email alert | Send email action | Requires a configured SMTP or third‑party service. |
Code block example – extracting the price with a JavaScript expression:
// JavaScript expression used in Broma's "Read element" action
parseFloat(element.textContent.replace(/[^0-9.]/g, ""))
This expression strips all non‑numeric characters, ensuring the value is numeric before being written to the sheet.
Real‑World Example: Monitoring Product Prices on an E‑Commerce Site
Let's walk through a concrete scenario.
- Prompt:
Create a flow that runs daily at 08:00 on the product page https://shopsmart.com/product/12345. The flow should:
- Open the page
- Wait for the price element with class "price-current" to appear
- Read the price, remove the currency symbol, convert to a float
- If the price is lower than the stored baseline (saved in a Broma variable), update the baseline and send a Slack notification
- Otherwise, do nothing
- AI‑generated step list (simplified):
- Open URL: https://shopsmart.com/product/12345
- Wait for element ".price-current" (visible)
- Read element text into variable
priceText - JavaScript:
parseFloat(priceText.replace(/[^0-9.]/g, ""))→ variablepriceFloat - If
priceFloat < baselinethen- Update variable
baselinewithpriceFloat - Send Slack message: "Price dropped to $priceFloat"
- Update variable
- End If
- Building in Broma:
- Add an Open URL action with the product link.
- Add a Wait for element action; selector:
div.price-current(more robust than a class alone). - Insert a Read element action; target: same selector; store result in
priceText. - Add a Run JavaScript action; paste the expression above; store result in
priceFloat. - Use an If block: condition
priceFloat < baseline. - Inside the If, add a Set variable action to update
baselineand a Send email (or Slack webhook) action.
- Testing: Run the flow manually once, verify the price is captured correctly, and check the Slack message. If the page layout changes, adjust the selector to a more stable attribute like
data-product-price.
Handling Page Changes with Resilient Selectors
Even with AI help, pages evolve. To keep your flow stable:
- Prefer data attributes (
data-price,data-product-id) over generic class names. - Use CSS path hierarchy (e.g.,
section#product-details > div.price-current) to narrow down the element. - Combine multiple selectors with AND logic if needed (
div.price-current[data-env="prod"]). - Add a fallback wait: after the primary wait, include a short Wait (e.g., 2 seconds) before reading the element, giving the page time to settle.
- Leverage JavaScript to locate elements by innerHTML or text content when selectors are volatile.
Code snippet for a robust selector:
// Find the price element by its text content and data attribute
const selector = 'div[data-product-id="12345"]:contains("Price:")';
return document.querySelector(selector);
Scheduling and Reusing the Flow
Broma runs on your own Windows machine, so you control the schedule. To automate the daily execution:
- Open the Scheduler tab.
- Choose "Run at" and set the time (e.g., 08:00).
- Select the browser profile that holds the login session for the target site.
- Enable "Run in background" if you want the flow to continue while you work.
For team reuse, create a dedicated browser profile with the necessary cookies and extensions, then share the flow file (.broma) via a shared folder or cloud storage. Team members can import the flow into their own profiles, ensuring each user’s cookies and proxies stay isolated.
Troubleshooting Common Issues
| Symptom | Likely Cause | Fix |
|---|---|---|
| Element not found | Selector changed or page not fully loaded | Update selector, add a longer wait, or use a more specific attribute |
| Price reads as "0" | Page loads dynamic content after the wait | Increase wait time, or use a Wait for network idle action |
| Email not sent | SMTP credentials missing or blocked | Verify SMTP settings, enable two‑factor if required |
| Flow stops mid‑run | Unhandled exception in JavaScript | Wrap code in try { … } catch(e) { console.log(e); } and add a fallback step |
Summary and Next Steps
Prompt‑driven automation turns a descriptive sentence into a reliable Broma workflow without writing a single line of code. By following the five‑step loop — describe, let AI build, review, test, refine — you can:
- Reduce the time spent on manual selector hunting.
- Keep flows resilient to minor page updates.
- Scale automation across multiple users via isolated browser profiles.
- Integrate with external services (Google Sheets, Slack, email) for real‑time alerts.
Start by writing a simple prompt for a repetitive task you already perform. Run the AI‑generated steps in Broma, tweak the selectors, and schedule the flow. Within a few iterations you’ll have a hands‑free process that saves hours each week.
