Amazon Returns — Browser Skill
Purpose
Two workflows: (A) download and print all existing Amazon return labels; (B) create a new return from a photo of the item.
Dependencies
- browse CLI:
npm install -g @browserbasehq/browse-cli - Browserbase remote mode required (Amazon bot detection)
- Python venv:
/Users/martinp/Martin Secoond Brain/Amazon skills/.venv/ - Packages:
Pillow pyzbar qrcode[pil]+ nativezbar(brew) - Printer:
DYMO_LabelWriter_4XL(confirmed via lpstat) - Cookies:
/Users/martinp/Martin Secoond Brain/Amazon skills/amazon-cookies.jsonRefresh:node "/Users/martinp/Martin Secoond Brain/Amazon skills/scripts/bootstrap-amazon-session.mjs"
Workflow A: Download All Existing Return Labels
Step 1 — Inject auth
cd "/Users/martinp/Martin Secoond Brain/Amazon skills"
node scripts/inject-cookies.mjs --platform amazon
Step 2 — Run autobrowse loop
node ~/.claude/skills/autobrowse/scripts/evaluate.mjs \
--task amazon-return-labels-download \
--workspace autobrowse \
--env remote
Step 3 — Process and print each label
For each entry in the output JSON:
.venv/bin/python3 process-return-label.py \
"<screenshot_path>" "<item_name>"
Workflow B: Create New Return from Photo
Step 0 — Identify item (outer skill — NOT in browse session)
Use Claude vision on the attached photo:
"Identify this item in 10 words or less: brand, model, key features." Store as ITEM_DESCRIPTION.
Step 1 — Write item description into task
Use the Write tool to replace ITEM_DESCRIPTION_PLACEHOLDER in:
/Users/martinp/Martin Secoond Brain/Amazon skills/autobrowse/tasks/amazon-create-return/task.md
Step 2 — Inject auth
node "/Users/martinp/Martin Secoond Brain/Amazon skills/scripts/inject-cookies.mjs" --platform amazon
Step 3 — Run autobrowse
node ~/.claude/skills/autobrowse/scripts/evaluate.mjs \
--task amazon-create-return \
--workspace "/Users/martinp/Martin Secoond Brain/Amazon skills/autobrowse" \
--env remote
Step 4 — Print label
cd "/Users/martinp/Martin Secoond Brain/Amazon skills"
.venv/bin/python3 process-return-label.py \
"<screenshot_path from output JSON>" \
"$ITEM_DESCRIPTION"
Browse CLI Reference
browse stop— kill existing sessionbrowse env remote— start fresh Browserbase cloud sessionbrowse newpage <url>— open URL (required in remote mode)browse wait timeout <ms>— wait for SPA renderingbrowse get title— verify page / auth statebrowse get text body— read all visible textbrowse snapshot— accessibility tree with ref IDs [X-Y]browse click [X-Y]— click by refbrowse fill "<selector>" "<value>"— fill inputbrowse back— navigate backbrowse screenshot <path>— save PNG to CWD-relative path
Site-Specific Gotchas
- Amazon fires bot detection on every fresh browser session — Browserbase remote is mandatory
- Returns page direct URL:
/gp/css/returns/homepage.html— skip account menu - SPA pages need
browse wait timeout 2000after navigation beforebrowse snapshot - QR code label pages: QR may load async — wait 3000ms before screenshotting
- Free shipping check: scan for "$0.00" or "Free" text; UPS/USPS/Kohl's drop-off are usually free
- After
browse back: wait 1000ms before next click
Auth / Cookie Refresh
If title shows "Sign-In" mid-workflow:
- Re-run bootstrap:
node scripts/bootstrap-amazon-session.mjs - Re-run inject:
node scripts/inject-cookies.mjs --platform amazon - Retry from Step 2
Failure Recovery
- "no page available" → use
browse newpagenotbrowse openin remote mode - Spinner/blank page →
browse wait timeout 3000thenbrowse snapshot - Order not found → use "past 3 months" time filter before failing
Expected Output (Workflow B)
{
"success": true,
"order_id": "113-XXXXXXX-XXXXXXX",
"item_name": "Matched item from order",
"screenshot_path": "screenshots/return-label-1234567890.png",
"label_type": "qr_code"
}