Search and purchase products on Amazon via Chrome automation. Trigger words - amazon, order, buy, shopping, purchase, add to cart, order from amazon.
Search, browse, and purchase products on Amazon using Chrome automation via chrome-control.
# Search for a product
~/.claude/skills/amazon/scripts/amazon-search "ESP32-S3-BOX-3"
# Search within a category
~/.claude/skills/amazon/scripts/amazon-search "wireless earbuds" --category electronics
Based on the dj-buyer skill's Amazon purchase flow. Uses:
# Amazon account (Sven's account, NOT admin's)
security find-generic-password -s "assistant" -a "email" -w # Email
security find-generic-password -s "amazon-password" -w # Password
# Privacy.com payment card
security find-generic-password -a "sven" -s "privacy-card-number" -w
security find-generic-password -a "sven" -s "privacy-card-exp" -w # MM/YY
security find-generic-password -a "sven" -s "privacy-card-cvv" -w
security find-generic-password -a "sven" -s "privacy-card-name" -w
~/.claude/skills/amazon/scripts/amazon-search "product name"
~/.claude/skills/amazon/scripts/amazon-search "product name" --category electronics
~/.claude/skills/amazon/scripts/amazon-search "product name" --max-results 5
Returns: title, price, rating, ASIN, URL for each result.
chrome open "https://www.amazon.com/s?k=SEARCH+TERMS"
chrome text <tab> # Read results
chrome js <tab> "JSON.stringify([...document.querySelectorAll('[data-asin]')].filter(e=>e.dataset.asin).slice(0,5).map(e=>({asin:e.dataset.asin,title:e.querySelector('h2')?.textContent?.trim(),price:e.querySelector('.a-price .a-offscreen')?.textContent})))"
electronics — Electronics & Computerscomputers — Computers & Accessorieshome — Home & Kitchentools — Tools & Home Improvementbooks — Booksmusic — Digital Musictoys — Toys & Gamesoffice — Office Productsgarden — Patio, Lawn & Garden# 1. Clear the cart
chrome navigate <tab> "https://www.amazon.com/gp/cart/view.html"
# Delete any existing items to prevent checkout hijacking
# 2. Verify product page
chrome navigate <tab> "https://www.amazon.com/dp/<ASIN>"
chrome text <tab> # Confirm product name + price
chrome click-by-name <tab> "Add to Cart"
# Wait 2-3 seconds
# May see "Added to Cart" confirmation or upsell page
If product options (size, color, etc.) need selecting first:
chrome text <tab> # Read available options
chrome click-by-name <tab> "<option_value>"
chrome click-by-name <tab> "Proceed to checkout"
# OR navigate directly:
chrome navigate <tab> "https://www.amazon.com/gp/buy/spc/handlers/display.html?hasWorkingJavascript=1"
# Wait 3-5 seconds
chrome text <tab> # Look for "Sign in" or password prompt
If sign-in required:
# Enter email
chrome iframe-click <tab> "#ap_email"
chrome insert-text <tab> "$(security find-generic-password -s assistant -a email -w)"
chrome js <tab> "document.querySelector('#continue')?.click()"
# Wait 2 seconds
# Enter password
chrome iframe-click <tab> "#ap_password"
chrome insert-text <tab> "$(security find-generic-password -s amazon-password -w)"
chrome js <tab> "document.querySelector('#signInSubmit')?.click()"
# Wait 3 seconds
NOTE: click-by-name "Sign in" may hit heading text, not the submit button. Use chrome js with querySelector.
Amazon may prompt "Keep hackers out" (phone verification) — skip it:
chrome click-by-name <tab> "Not now"
chrome text <tab> # Check: shipping address, payment method, order total
Verify:
chrome click-by-name <tab> "Place your order"
# Wait 5-10 seconds
If billing address error:
chrome click-by-name <tab> "Continue" # Usually works on retry
Success page shows: "Order placed, thank you!"
chrome text <tab> # Get order number + delivery estimate
Report: order number, estimated delivery, total charged.
For MP3/digital music, use the streamlined flow:
chrome navigate <tab> "https://www.amazon.com/dp/<ASIN>"
chrome click-by-name <tab> "Purchase Options"
# Wait 1 second
chrome click-by-name <tab> "MP3 Music"
# Wait 3 seconds
chrome click-by-name <tab> "Buy MP3 Song - Pay Now"
# Wait 5 seconds
chrome click-by-name <tab> "Download"
Card form is in a cross-origin secure iframe — cannot fill via chrome js.
chrome navigate <tab> "https://www.amazon.com/cpe/yourpayments/wallet"
# Click "Add a payment method" -> "Add a credit or debit card"
# Use axctl for cross-origin iframe
CARD_NUM=$(security find-generic-password -a "sven" -s "privacy-card-number" -w)
CARD_CVV=$(security find-generic-password -a "sven" -s "privacy-card-cvv" -w)
CARD_NAME=$(security find-generic-password -a "sven" -s "privacy-card-name" -w)
axctl type "Google Chrome" --title "Card number" "$CARD_NUM"
axctl type "Google Chrome" --title "Name on card" "$CARD_NAME"
axctl type "Google Chrome" --role AXTextField --index 4 "$CARD_CVV"
Expiration dropdowns require coordinate clicking:
axctl get "Google Chrome" --title "Expiration date" AXPosition
cliclick c:<center_x>,<center_y> # Open dropdown
axctl search "Google Chrome" --role AXMenuItem
cliclick c:<item_x>,<item_y> # Select month/year
If account goes on hold ("Account on hold temporarily"):
https://account-status.amazon.com/chrome (real browser) not scrapling for purchase flowsAlways clear cart before purchasing. Stale items hijack checkout.
Re-sign in and retry. Payment method may need re-adding.
Use chrome js with document.querySelector() as fallback.
After clicking "Add to Cart", Amazon sometimes shows a full-page Prime upsell instead of the cart confirmation. This blocks the checkout flow.
Primary path — click by name (try these in order):
chrome click-by-name <tab> "No thanks"
# OR
chrome click-by-name <tab> "Continue without Prime"
JS fallback (if click-by-name fails):
chrome js <tab> "document.querySelector('[data-action=\"prime-upsell-decline\"], [id*=\"no-thanks\"], [id*=\"noThanks\"]')?.click()"
Note: After every "Add to Cart", check for Prime upsell and dismiss before proceeding to checkout. This interstitial has been seen multiple times during Roomba parts checkout.