Automate Workflows with VespucciBAS: Step-by-Step Examples
VespucciBAS is a browser automation and scripting tool designed to automate repetitive web tasks. Below are three practical, step-by-step examples to help you build reliable automation workflows quickly: a web form filler, a data scraper that exports CSV, and a scheduled email sender. Each example includes prerequisites, the script outline, key commands, and testing tips.
Prerequisites (assumed)
- VespucciBAS installed and configured in your browser.
- Basic familiarity with the VespucciBAS scripting UI and its recorder.
- Target web pages accessible and not blocked by anti-bot protections.
- (For email automation) access to an SMTP server or webmail that allows automated sending.
Example 1 — Web form filler (signup form)
Goal: Automatically fill and submit a signup form repeatedly with different user data.
- Outline
- Load signup page.
- Wait for form to appear.
- Fill name, email, password fields.
- Select options / check terms.
- Submit and confirm success.
- Log result and proceed to next record.
- Key script steps (pseudocode)
- Open URL(”https://example.com/signup”)
- WaitFor(selector: “#signup-form”, timeout: 10s)
- Type(selector: “#name”, value: record.name)
- Type(selector: “#email”, value: record.email)
- Type(selector: “#password”, value: record.password)
- Click(selector: “#terms-checkbox”)
- Click(selector: “#submit-button”)
- WaitFor(selector: “.success-message”, timeout: 10s)
- If success -> Log(“Submitted: ” + record.email) else -> Screenshot() + LogError()
- Data source
- Use CSV or built-in array: name,email,password per row.
- Loop over rows with ForEachRow or equivalent.
- Tips
- Use explicit waits (WaitFor) rather than fixed delays.
- Use unique selectors (IDs preferred). Use XPath only if needed.
- Add random small delays (200–800 ms) between actions to mimic human timing.
- Handle captchas and rate limits—if present, automation may fail.
Example 2 — Data scraper exporting CSV
Goal: Extract product titles, prices, and links from a category page and save to CSV.
- Outline
- Open category page.
- Scroll/load all items (handle infinite scroll).
- For each item element, extract title, price, link.
- Save rows to CSV.
- Key script steps (pseudocode)
- Open URL(”https://example.com/category”)
- While( new content loaded ) { ScrollToBottom(); Wait(1s) }
- items = QuerySelectorAll(“.product-card”)
- For each item in items:
- title = GetText(item, “.product-title”)
- price = GetText(item, “.price”)
- href = GetAttr(item, “a.product-link”, “href”)
- AppendCSV([“title”,“price”,“href”], [title, price, href])
- SaveCSV(“products.csv”)
- Tips
- Use pagination or infinite-scroll detection to ensure complete scraping.
- Normalize prices (remove currency symbols) before saving.
- Respect robots.txt and site terms; avoid aggressive scraping.
Example 3 — Scheduled email sender (daily report)
Goal: Collect a small dataset from a dashboard and send it via email each morning.
- Outline
- Open dashboard and authenticate.
- Extract metrics (e.g., daily active users, revenue).
- Compose email body with metrics.
- Send via SMTP or webmail form.
- Schedule the script to run daily via VespucciBAS scheduler or OS cron invoking headless browser.
- Key script steps (pseudocode)
- Open URL(”https://example.com/dashboard”)
- WaitFor(“#login”, 10s); Type(“#user”, user); Type(“#pass”, pass); Click(“#login”)
- WaitFor(“.metrics”, 10s)
- users = GetText(“.metric-users”)
- revenue = GetText(“.metric-revenue”)
- body = “Daily report: Users: ” + users + “ Revenue: ” + revenue
- If using SMTP:
- SMTPConnect(host, port, user, pass)
- SMTPSend(from, to, subject, body)
- If using webmail form:
- Open URL(webmail compose)
- Type(“#to”, to); Type(“#subject”, subject); Type(“#body”, body); Click(“#send”)
- Log(“Report sent: ” + todayDate)
- Tips
- Store credentials securely (use encrypted vault or OS secret store).
- Add retries for transient network failures.
- Include a failure notification to an alternate address on errors.
Testing and reliability checklist
- Run scripts in a controlled environment first and inspect logs/screenshots.
- Add robust error handling: try/catch, retries with backoff, and screenshots on failure.
- Use environment variables or a secure vault for credentials.
- Limit concurrency and add randomized delays to reduce detection risk.
- Monitor for site layout changes—selectors may need updates.
Maintenance recommendations
- Keep a concise README per script describing purpose, inputs, and scheduled runs.
- Version control scripts and data files.
- Re-run and validate scripts after any upstream site redesign.
- Schedule periodic manual reviews (weekly or monthly) to ensure outputs remain correct.
Quick starter template (pseudocode)
- Load URL
- Authenticate if needed
- Wait for target elements
- Loop over data or elements
- Extract / Fill / Click
- Save results or send output
- Log outcomes and handle errors
Use these examples as templates: adapt selectors, timeouts, and storage to your specific site and workflow. Start with the simpler tasks (form fill) to build familiarity before moving to scheduled or large-scale scraping automations.
Leave a Reply