[{"data":1,"prerenderedAt":19},["ShallowReactive",2],{"blog-post-en-building-resilient-price-tracker-in-broma":3},{"slug":4,"lang":5,"title":6,"summary":7,"date":8,"tags":9,"tag_slugs":14,"thumbnail_url":15,"translations":16,"body":17,"asset_base":18},"building-resilient-price-tracker-in-broma","en","Building a Resilient Price Tracker in Broma: Multi‑Step Monitoring Flow","Create a robust Broma workflow that tracks product prices across sites, handles page updates, and logs changes automatically.","2026-11-10",[10,11,12,13],"broma","price-monitoring","browser-automation","workflow",[10,11,12,13],"https:\u002F\u002Fblog-api.bromaapp.com\u002Fapi\u002Fblog\u002Fposts\u002Fbuilding-resilient-price-tracker-in-broma\u002Fthumbnail.svg?lang=en",[5],"## Why a Dedicated Price Tracker Matters\n\nE‑commerce operators, marketers, and QA teams often need to watch prices, stock levels, or competitor offers on a regular basis. Manually checking dozens of URLs each day is tedious, error‑prone, and quickly becomes a bottleneck. A Broma flow lets you automate this repetitive check, keep a historical log, and react when prices cross a threshold—all without writing a single line of code.\n\nThe key to a reliable price tracker is **resilience**. Web pages change selectors, layout, or even the HTML tags that hold price information. A flow that relies on a fragile selector will break, leaving you with missed alerts. In this guide we’ll build a complete price‑monitoring workflow that:\n\n* Uses stable selectors (data‑attrs, consistent CSS classes) that survive minor redesigns.\n* Stores previous prices in a simple CSV file so you can detect changes.\n* Takes a screenshot only when a price moves, reducing noise.\n* Logs the new price, timestamp, and any change amount.\n* Runs on a schedule and records each run in Broma’s run log.\n* Reuses the same flow across multiple products and team members using separate browser profiles.\n\n---\n\n## 1. Set Up a Dedicated Browser Profile\n\nBefore you start building the flow, isolate your price‑checking work from everyday browsing. Broma’s profile manager lets you create a new profile that carries its own cookies, extensions, and proxy settings.\n\n1. Open **Broma** → **Profiles** → **Add Profile**.\n2. Name it **PriceTracker**.\n3. Enable any required extensions (e.g., a password manager if you need to log in).\n4. Choose a proxy if you need to rotate IPs (optional).\n5. Save the profile.\n\nAll subsequent flows will use this profile, keeping your login state and any site‑specific cookies intact.\n\n---\n\n## 2. Describe the Flow in Plain Language (AI‑Assisted)\n\nBroma’s AI can turn a natural‑language description into a functional workflow. Open the **AI Builder** and paste something like:\n\n> \"Open the product page for URL https:\u002F\u002Fexample.com\u002Fproduct\u002F123, wait for the price element, read its text, compare with the value stored in \u002Fdata\u002Fprevious_prices.csv, and if it changed, write the new price to the CSV and capture a screenshot.\"\n\nThe AI will generate the steps, but you’ll still need to review and fine‑tune selectors and data paths. This approach is great for rapid prototyping, and you’ll end up with a solid foundation to refine.\n\n---\n\n## 3. Choose Selectors That Survive Page Changes\n\nWhen you review the AI‑generated flow, replace any volatile CSS or XPath selectors with more durable ones. Look for:\n\n* **data-testid** or **data-cy** attributes.\n* **aria‑label** combined with a parent tag.\n* Consistent CSS classes that are unlikely to be renamed (e.g., `.price`, `.current-price`).\n\nFor example, if the price on `example.com` lives in `\u003Cspan class=\"price\">$49.99\u003C\u002Fspan>` and the site occasionally wraps it in a `\u003Cdiv>`, you can target the parent element and then extract the inner text:\n\n```javascript\n\u002F\u002F Select the price container (stable selector)\nconst priceContainer = document.querySelector('[data-testid=\"product-price\"]');\n\u002F\u002F Fallback to CSS class if data attribute missing\nif (!priceContainer) {\n  priceContainer = document.querySelector('.price');\n}\n\u002F\u002F Extract text and clean formatting\nconst raw = priceContainer.textContent.trim();\nconst price = raw.replace(\u002F[^0-9.,]\u002Fg, ''); \u002F\u002F keep numbers and commas\nreturn price;\n```\n\nAdd this snippet as a **Custom JavaScript** step in Broma to ensure you always get a clean numeric value.\n\n---\n\n## 4. Store and Compare Previous Prices\n\nCreate a simple CSV file (e.g., `price_tracker.csv`) in a folder you can access from the workflow. The file should have three columns:\n\n* `url` – the product page URL\n* `previous_price` – last known price (numeric)\n* `last_updated` – timestamp of the last check\n\n**Initial setup** – If the CSV does not exist, Broma can create it with a “Create if missing” step. Populate it with the first known price manually, or let the flow write a placeholder.\n\n**Comparison logic** – In Broma you can add a **Conditional** step that runs JavaScript to compare the extracted price with the stored value:\n\n```javascript\nconst url = \"https:\u002F\u002Fexample.com\u002Fproduct\u002F123\";\nconst stored = getCSVValue(url, 'previous_price'); \u002F\u002F custom function you add via a “Read CSV” step\nconst current = price; \u002F\u002F from the extraction step\nif (parseFloat(current) !== parseFloat(stored)) {\n  \u002F\u002F price changed – trigger actions\n  setVar('price_changed', true);\n  setVar('old_price', stored);\n  setVar('new_price', current);\n} else {\n  setVar('price_changed', false);\n}\n```\n\nBroma’s **Branch** step lets you route to “If changed” and “If unchanged” sections of the flow.\n\n---\n\n## 5. Log the New Price and Capture a Screenshot\n\n### 5.1 Update the CSV\n\nWhen a change is detected, write the new price back to the CSV and also append a timestamp. Broma’s **Write CSV** step can be configured to **append** or **overwrite** based on the URL.\n\n```text\nFile: price_tracker.csv\nColumns: url, previous_price, last_updated\nAction: Append\nValues: https:\u002F\u002Fexample.com\u002Fproduct\u002F123, $49.99, 2025-12-17T14:23:00Z\n```\n\n### 5.2 Screenshot (Optional but Useful)\n\nAdd a **Take Screenshot** step that runs only in the “changed” branch. Name the file with a timestamp and the product identifier, e.g., `price_change_2025-12-17_14-23-01.png`. This visual proof is handy for audit trails.\n\n---\n\n## 6. Schedule the Flow and Review Run Logs\n\n1. In Broma’s **Scheduler**, add a new job.\n2. Set the **Trigger** to “Every day at 09:00” (or any interval you need).\n3. Point the job to the **Price Tracker** flow you just built.\n4. Enable **Run logs** – Broma will store each execution status, errors, and output.\n\nWhen you open the **Run History**, you’ll see:\n\n* Success\u002Ffailure status.\n* Timestamp of each run.\n* Any error messages (e.g., selector missing).\n* Links to screenshots captured during that run.\n\nReviewing the log weekly helps you spot broken selectors before they cause missed price alerts.\n\n---\n\n## 7. Reusing the Flow Across Products and Team Members\n\nBecause the flow is built around a generic **URL** and **price selector** variable, you can parameterize it:\n\n* Add a **Input** step at the start that asks for `product_url` and `price_selector`.\n* Use Broma’s **Set Variable** to inject these values before the extraction step.\n\nDifferent team members can each have their own **PriceTracker** profile (see Step 1). By sharing the same flow file, they avoid duplication while keeping login cookies isolated.\n\nIf you need to monitor dozens of products, create a master **CSV of URLs** and loop over them using Broma’s **For Each** step. For each URL, run the same price‑check logic and write results to a combined report CSV.\n\n---\n\n## 8. Troubleshooting Common Issues\n\n| Symptom | Likely Cause | Quick Fix |\n|---------|--------------|-----------|\n| No price extracted | Selector outdated after site redesign | Switch to a more stable `data-testid` or add a fallback CSS selector in the custom JS step. |\n| Flow fails with “Element not found” | Page loads slowly or requires waiting for lazy‑loaded content | Insert a **Wait for Element** step with a longer timeout, or add a **Wait for Network Idle** before extraction. |\n| CSV writes duplicate rows | Append mode without checking existing entry | Use a **Read CSV** step to check if URL exists first, then decide to **Update** vs **Append**. |\n| Scheduled run never starts | Scheduler service not running or incorrect time zone | Verify Broma’s scheduler daemon is active and set the correct timezone in Settings. |\n\n---\n\n## 9. Extending the Flow (Optional Enhancements)\n\n* **Email Alerts** – Add a **Send Email** step (configure SMTP in Broma) that triggers only when a price drops above a threshold.\n* **Slack\u002FTeams Notification** – Use a webhook step to post a message with the old\u002Fnew price.\n* **Price Trend Analysis** – Append a rolling average column in the CSV and generate a simple line chart using an external tool (e.g., Python pandas) on the exported data.\n\nThese extensions keep the core flow simple and maintainable while giving you powerful reporting capabilities.\n\n---\n\n## 10. Recap – Key Takeaways\n\n* **Isolation matters** – a dedicated browser profile protects login state and avoids cookie conflicts.\n* **Stable selectors** – prioritize `data-testid` or consistent class names; always include a fallback in custom JavaScript.\n* **Comparison logic** – store previous prices in a CSV, compare each run, and branch actions based on change detection.\n* **Logging and screenshots** – capture visual evidence only when needed to reduce clutter and aid audits.\n* **Scheduling and review** – rely on Broma’s built‑in scheduler and run logs to keep the workflow healthy over time.\n* **Reusability** – parameterize URLs and selectors, and loop over multiple products to scale without rebuilding.\n\nBy following the steps above you’ll have a production‑ready price tracker that runs automatically, adapts to minor page changes, and gives you actionable insights without any coding effort. Happy automating!\n","https:\u002F\u002Fblog-api.bromaapp.com\u002Fapi\u002Fblog\u002Fposts\u002Fbuilding-resilient-price-tracker-in-broma\u002Fassets",1794729620823]