Skip to content

galiprandi/job-seeker / .agents/skills/browser-automation

browser-automation

Verified

Control a dedicated browser via agent-browser (Vercel). Use when automating web apps, scraping authenticated sites, filling forms, or navigating SPAs. Do NOT use for desktop apps or API-only integrations.

FileKindSize
SETUP.mdmarkdown3.0 KB
SKILL.mdskill md39.4 KB
references/agent-browser.mdmarkdown4.6 KB
references/api-capture.mdmarkdown1.8 KB
references/ats-patterns.mdmarkdown4.5 KB
references/audio-transcription.mdmarkdown2.4 KB
references/custom-combobox.mdmarkdown5.0 KB
references/efficiency-patterns.mdmarkdown2.6 KB
references/golden-rules.mdmarkdown5.7 KB
references/key-patterns.mdmarkdown4.4 KB
references/network-console.mdmarkdown1.2 KB
references/parallel-agents.mdmarkdown6.2 KB
references/profile-management.mdmarkdown6.3 KB
references/token-extraction.mdmarkdown2.8 KB
scripts/README.mdmarkdown6.0 KB
scripts/agent-browser.template.jsonconfig333 B
scripts/browser-share.jsscript20.0 KB
scripts/browser.jsexecutablescript17.1 KB
scripts/teams.jsscript7.1 KB
scripts/test-find-guide.jsscript6.3 KB
scripts/transcribe-audio.jsscript3.6 KB
scripts/viewer.htmlother8.6 KB
sites/CONTRIBUTING.mdmarkdown11.0 KB
sites/LEARN.mdmarkdown5.4 KB
sites/afip_gob_ar/guide.mdmarkdown9.0 KB
sites/app_web3forms_com/guide.mdmarkdown7.1 KB
sites/buk_co/guide.mdmarkdown1.5 KB
sites/calendar_google_com/calendar-deeplink.mdmarkdown1.9 KB
sites/calendly_com/guide.mdmarkdown1001 B
sites/careers_epam_com/guide.mdmarkdown4.4 KB
sites/dash_cloudflare_com/guide.mdmarkdown7.7 KB
sites/discord_com/guide.mdmarkdown9.9 KB
sites/discord_com/login-flow.mdmarkdown3.2 KB
sites/docs_google_com/guide.mdmarkdown7.3 KB
sites/facebook_com/guide.mdmarkdown9.8 KB
sites/gmail_com/guide.mdmarkdown35.6 KB
sites/google_com/guide.mdmarkdown1.1 KB
sites/google_com/login-flow.mdmarkdown3.3 KB
sites/google_home_com/guide.mdmarkdown2.1 KB
sites/google_maps_com/guide.mdmarkdown8.4 KB
sites/groq_com/signup-apikey.mdmarkdown6.6 KB
sites/humand_co/guide.mdmarkdown6.9 KB
sites/jira_com/guide.mdmarkdown10.8 KB
sites/linkedin_com/guide.mdmarkdown27.4 KB
sites/linkedin_com/outreach-strategy.mdmarkdown1.2 KB
sites/linkedin_com/posting.mdmarkdown14.0 KB
sites/linkedin_com/voyager-api.mdmarkdown8.1 KB
sites/mercadolibre_com/guide.mdmarkdown4.5 KB
sites/onstrider_com/draftjs-editor-fill.mdmarkdown2.3 KB
sites/onstrider_com/guide.mdmarkdown11.3 KB
sites/onstrider_com/react-autocomplete-inputs.mdmarkdown4.0 KB
sites/outlook_office_com/calendar-deeplink.mdmarkdown2.2 KB
sites/outlook_office_com/guide.mdmarkdown14.0 KB
sites/property_directory/guide.mdmarkdown3.7 KB
sites/reddit_com/guide.mdmarkdown16.2 KB
sites/teams_com/guide.mdmarkdown10.3 KB
sites/teamtailor_com/guide.mdmarkdown6.5 KB
sites/vea_com_ar/guide.mdmarkdown8.8 KB
sites/whatsapp_com/guide.mdmarkdown21.3 KB
sites/whatsapp_com/login-flow.mdmarkdown3.0 KB
sites/whatsapp_com/message-extraction.mdmarkdown5.7 KB
sites/whatsapp_com/voice-notes.mdmarkdown7.1 KB
sites/workatastartup_com/guide.mdmarkdown1.5 KB

sites/reddit_com/guide.md

View on GitHub
---
name: reddit
description: Automate Reddit with agent-browser. Covers navigating posts, reading comments, posting top-level submissions, replying to comments, posting in megathreads, and extracting post/comment data. Use when checking post status, responding to comments, or submitting to subreddits.
verified: 2026-09-02
domains:
  - reddit.com
  - www.reddit.com
  - old.reddit.com
  - sh.reddit.com
  - new.reddit.com
---

# Reddit Automation

Automate Reddit via `agent-browser` using a mix of UI interactions, eval-based content extraction, and direct DOM manipulation for posting.

**Prerequisite:** Read the main Browser Automation guide first for profile-dir setup, the safe wrapper, and golden rules.

## Setup

```bash
# Open Reddit — ALWAYS headed (headless triggers 403 bot detection, see below)
node .agents/skills/browser-automation/scripts/browser.js open "https://www.reddit.com" --headed

# If login needed: user logs in manually. The session persists in .browser-profile —
# no save/load step exists or is needed.

# Next sessions: reopen headed
node .agents/skills/browser-automation/scripts/browser.js open "https://www.reddit.com" --headed
```

## Reading posts and comments

### Extract post content and comments (PREFERRED: eval)

```bash
# Navigate to post
node .agents/skills/browser-automation/scripts/browser.js goto "https://www.reddit.com/r/<sub>/comments/<id>/"

# Wait for load
node .agents/skills/browser-automation/scripts/browser.js exec wait --fn "document.body && document.body.innerText.length > 500"

# Extract full page text (includes post body + all visible comments)
node .agents/skills/browser-automation/scripts/browser.js exec eval "(() => document.body.innerText.substring(0, 5000))()"

# Extract more if needed
node .agents/skills/browser-automation/scripts/browser.js exec eval "(() => document.body.innerText.substring(5000, 10000))()"
```

### Extract structured comment data

```bash
node .agents/skills/browser-automation/scripts/browser.js exec eval "(function(){
  const text = document.body.innerText;
  const idx = text.indexOf('Sección de comentarios');
  if (idx === -1) {
    // Try English
    const enIdx = text.indexOf('Comment section');
    return text.substring(enIdx !== -1 ? enIdx : 0, (enIdx !== -1 ? enIdx : 0) + 5000);
  }
  return text.substring(idx, idx + 5000);
})()"
```

### Check if a post was removed by moderators

Posts removed by mods show one of these phrases in `document.body.innerText`:

- Spanish: `"Lo sentimos, esta publicación ha sido retirada por los moderadores"`
- English: `"Sorry, this post has been removed by the moderators"`
- Also: `"Publicación bloqueada. No se pueden publicar nuevos comentarios."` (post locked, no new comments)

```bash
node .agents/skills/browser-automation/scripts/browser.js exec eval "(() => {
  const t = document.body.innerText;
  if (t.includes('retirada por los moderadores') || t.includes('removed by the moderators')) return 'removed';
  if (t.includes('Publicación bloqueada') || t.includes('post has been locked')) return 'locked';
  return 'active';
})()"
```

### Find all posts by a user

```bash
node .agents/skills/browser-automation/scripts/browser.js goto "https://www.reddit.com/user/<username>/submitted/"
node .agents/skills/browser-automation/scripts/browser.js exec eval "(function(){
  const links = Array.from(document.querySelectorAll('a[href*=\"/comments/\"]'));
  return links.map(a => a.href).filter((v,i,arr) => arr.indexOf(v) === i).slice(0, 20);
})()"
```

### Read a specific comment by URL

```bash
node .agents/skills/browser-automation/scripts/browser.js goto "https://www.reddit.com/r/<sub>/comments/<post_id>/comment/<comment_id>/"
node .agents/skills/browser-automation/scripts/browser.js exec eval "(() => document.body.innerText.substring(0, 3000))()"
```

## Posting a top-level submission

### Navigate to submit page

```bash
node .agents/skills/browser-automation/scripts/browser.js goto "https://www.reddit.com/r/<subreddit>/submit/"
```

### Fill title and body

Reddit's new UI uses a rich-text editor. The title is an input, the body is a contenteditable div.

```bash
# Wait for editor to load
node .agents/skills/browser-automation/scripts/browser.js exec wait --fn "document.querySelectorAll('input, textarea, div[contenteditable=true]').length > 0"

# Fill title (find the title input - it's usually the first visible text input)
node .agents/skills/browser-automation/scripts/browser.js exec eval "(function(){
  const inputs = document.querySelectorAll('input[type=\"text\"], input:not([type])');
  for (const inp of inputs) {
    const r = inp.getBoundingClientRect();
    if (r.width > 0 && r.height > 0) {
      const nativeSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set;
      nativeSetter.call(inp, 'YOUR TITLE HERE');
      inp.dispatchEvent(new Event('input', { bubbles: true }));
      return 'title_set';
    }
  }
  return 'title_not_found';
})()"

# Fill body (contenteditable div)
node .agents/skills/browser-automation/scripts/browser.js exec eval "(async function(){
  const all = document.querySelectorAll('div[contenteditable=true]');
  for (const e of all) {
    const r = e.getBoundingClientRect();
    if (r.width > 0 && r.height > 0) {
      e.focus();
      e.innerText = '';
      document.execCommand('insertText', false, 'YOUR BODY TEXT HERE');
      return 'body_set';
    }
  }
  return 'no_editor_visible';
})()"
```

### Submit the post

```bash
# Semantic-first (unverified after agent-browser migration):
node .agents/skills/browser-automation/scripts/browser.js exec find role button "Publicar" click
node .agents/skills/browser-automation/scripts/browser.js exec find role button "Post" click

# Fallback via eval:
node .agents/skills/browser-automation/scripts/browser.js exec eval "(function(){
  const btns = document.querySelectorAll('button, div[role=button]');
  for (const b of btns) {
    const t = b.textContent.trim().toLowerCase();
    const r = b.getBoundingClientRect();
    if (r.width > 0 && r.height > 0 && (t === 'publicar' || t === 'post' || t === 'submit' || t === 'enviar')) {
      b.dispatchEvent(new MouseEvent('mousedown', { bubbles: true }));
      b.dispatchEvent(new MouseEvent('click', { bubbles: true }));
      b.dispatchEvent(new MouseEvent('mouseup', { bubbles: true }));
      return 'submitted';
    }
  }
  return 'not_found';
})()"
```

## Replying to comments and posting in megathreads

This is the most reliable pattern, validated empirically. Reddit's comment editor is a `div[contenteditable=true]` that appears after clicking a "Responder" (Spanish) or "Reply" (English) button.

### Step 1: Click "Responder" to open the comment editor

```bash
# Semantic-first attempt (works for the top-level "Responder"/"Reply" button;
# unverified after agent-browser migration — per-comment buttons live in shadow DOM)
node .agents/skills/browser-automation/scripts/browser.js exec find role button "Responder" click
node .agents/skills/browser-automation/scripts/browser.js exec find role button "Reply" click

# Fallback: scroll to the comment section and click via eval
node .agents/skills/browser-automation/scripts/browser.js exec eval "(async function(){
  window.scrollTo(0, 800);
  await new Promise(r => setTimeout(r, 500));
  const btns = document.querySelectorAll('button');
  for (const b of btns) {
    const t = b.textContent.trim();
    const r = b.getBoundingClientRect();
    if (r.width > 0 && r.height > 0 && (t === 'Responder' || t === 'Reply')) {
      b.click();
      return 'clicked';
    }
  }
  return 'not_found';
})()"
```

### Step 2: Wait for the contenteditable editor to appear

```bash
node .agents/skills/browser-automation/scripts/browser.js exec wait --fn "Array.from(document.querySelectorAll('div[contenteditable=true]')).some(e => { const r = e.getBoundingClientRect(); return r.width > 0 && r.height > 0; })"
```

### Step 3: Fill the comment text

Use `document.execCommand('insertText', ...)` — this is the reliable method for Reddit's contenteditable. Do NOT use `innerText =` alone (React state doesn't update). Do NOT use `fill` (it's not a textarea).

```bash
node .agents/skills/browser-automation/scripts/browser.js exec eval "(async function(){
  const all = document.querySelectorAll('div[contenteditable=true]');
  for (const e of all) {
    const r = e.getBoundingClientRect();
    if (r.width > 0 && r.height > 0) {
      e.focus();
      e.innerText = '';
      const text = 'YOUR COMMENT TEXT HERE.\\n\\nMultiple paragraphs work with \\\\n.';
      document.execCommand('insertText', false, text);
      return 'filled';
    }
  }
  return 'no_editor_visible';
})()"
```

### Step 4: Click "Comentar" / "Comment" to submit

```bash
# Semantic-first (unverified after agent-browser migration):
node .agents/skills/browser-automation/scripts/browser.js exec find role button "Comentar" click
node .agents/skills/browser-automation/scripts/browser.js exec find role button "Comment" click

# Fallback via eval:
node .agents/skills/browser-automation/scripts/browser.js exec eval "(function(){
  const btns = document.querySelectorAll('button');
  for (const b of btns) {
    const t = b.textContent.trim();
    const r = b.getBoundingClientRect();
    if (r.width > 0 && r.height > 0 && (t === 'Comentar' || t === 'Comment')) {
      b.dispatchEvent(new MouseEvent('mousedown', { bubbles: true }));
      b.dispatchEvent(new MouseEvent('click', { bubbles: true }));
      b.dispatchEvent(new MouseEvent('mouseup', { bubbles: true }));
      return 'clicked';
    }
  }
  return 'not_found';
})()"
```

### Step 5: Verify the comment was posted

```bash
# Wait and check if the editor closed (indicates success)
node .agents/skills/browser-automation/scripts/browser.js exec eval "(async function(){
  for (let i = 0; i < 15; i++) {
    const all = document.querySelectorAll('div[contenteditable=true]');
    let visible = false;
    for (const e of all) {
      const r = e.getBoundingClientRect();
      if (r.width > 0 && r.height > 0) visible = true;
    }
    if (!visible) return 'editor_closed_success';
    await new Promise(r => setTimeout(r, 500));
  }
  return 'editor_still_open';
})()"
```

## Megathread posting

Posting in megathreads (e.g. "Built with Claude Project Showcase Megathread", "Weekly Showcase Thread") follows the same pattern as replying to comments. The megathread is a post, and you reply to it as a top-level comment.

### Finding the megathread URL

```bash
# Search for the megathread in a subreddit
node .agents/skills/browser-automation/scripts/browser.js goto "https://www.reddit.com/r/<subreddit>/search/?q=showcase+megathread&sort=new&restrict_sr=on"
node .agents/skills/browser-automation/scripts/browser.js exec eval "(function(){
  const links = Array.from(document.querySelectorAll('a[href*=\"/comments/\"]'));
  return links.map(a => ({text: a.innerText.substring(0, 80), href: a.href})).filter(l => l.text.length > 10).slice(0, 10);
})()"
```

### Post in the megathread

Navigate to the megathread URL, then follow the "Replying to comments" pattern above. The "Responder" button on the megathread post opens a top-level comment editor.

## Reddit UI language detection

Reddit's UI language depends on the browser profile and account settings. Key button labels:

| English | Spanish |
|---|---|
| Reply | Responder |
| Comment | Comentar |
| Post | Publicar |
| Submit | Enviar |
| Cancel | Cancelar |
| Share | Compartir |
| Comment section | Sección de comentarios |

Always check for both languages when searching for buttons by text.

## Common subreddit moderation patterns

### Post removal by moderators

Many subreddits have automated moderation bots (AutoModerator, ClaudeAI-mod-bot) that remove promotional posts and leave a comment explaining why. Common patterns:

- **Redirect to megathread**: "Please repost this in the Weekly Showcase Thread" or "Please submit your project as a comment in the Megathread"
- **Karma requirement**: "Sorry, you do not meet the minimum sitewide comment karma requirement of N to post a submission"
- **Rule violation**: "Promotional or advertising threads are only allowed in the monthly stickied threads"

### What to do when a post is removed

1. **Do NOT repost the same content** in the subreddit feed — it will be removed again.
2. **DO post in the megathread** the mod bot redirected you to. This is the sanctioned location.
3. **Check subreddit rules** before posting: navigate to `https://www.reddit.com/r/<sub>/about/rules/` or look for a rules sidebar.

## Extracting comment authors and timestamps

```bash
node .agents/skills/browser-automation/scripts/browser.js exec eval "(function(){
  const comments = document.querySelectorAll('[data-testid=\"comment\"], shreddit-comment');
  if (comments.length === 0) {
    // Fallback: parse from body text
    const text = document.body.innerText;
    const idx = text.indexOf('Sección de comentarios');
    if (idx === -1) return 'no_comments_found';
    return text.substring(idx, idx + 3000);
  }
  return Array.from(comments).map(c => c.innerText.substring(0, 300)).join('\\n---\\n');
})()"
```

## Tips

### Reddit loads dynamically — always wait

Reddit is a heavy SPA. After `goto`, use in-page polling:

```bash
node .agents/skills/browser-automation/scripts/browser.js exec wait --fn "document.body && document.body.innerText.length > 500"
```

### The comment editor is lazy-loaded

The `div[contenteditable=true]` editor only appears after clicking "Responder". It has `width: 0, height: 0` before that. Do NOT try to find the editor before clicking "Responder".

### Scrolling reveals more comments

Reddit lazy-loads comments on scroll. To see all comments:

```bash
node .agents/skills/browser-automation/scripts/browser.js exec eval "(async function(){
  for (let i = 0; i < 5; i++) {
    window.scrollTo(0, document.body.scrollHeight);
    await new Promise(r => setTimeout(r, 1000));
  }
  return 'scrolled';
})()"
```

### "Ver más comentarios" / "View more comments" button

If you see this button, click it to expand collapsed comment threads:

```bash
node .agents/skills/browser-automation/scripts/browser.js exec eval "(function(){
  const btns = document.querySelectorAll('button');
  for (const b of btns) {
    const t = b.textContent.trim();
    if (t.includes('Ver más comentarios') || t.includes('View more comments')) {
      b.click();
      return 'clicked';
    }
  }
  return 'not_found';
})()"
```

## Anti-patterns

- **Don't** use curl to access Reddit JSON API or RSS feeds — all HTTP endpoints return 403 for non-browser User-Agents
- **Don't** use headless mode for Reddit — it triggers 403 bot detection that poisons the entire session. Always use `--headed`
- **Don't** retry in headless after a 403 — `close --force` and reopen with `--headed` instead
- **Don't** try to fill the comment editor with `fill <ref>` — it's a contenteditable div, not a textarea. Use `eval` with `document.execCommand('insertText', ...)`
- **Don't** try to find the comment editor before clicking "Responder" — it's lazy-loaded and has zero dimensions until activated
- **Don't** repost promotional content in a subreddit feed after mod removal — post in the megathread instead
- **Don't** reuse refs after clicking "Responder" — the page re-renders, refs become stale
- **Don't** use `innerText =` alone for the comment editor — React state won't update. Use `execCommand('insertText')` instead
- **Don't** assume the UI is in English — Reddit may render in Spanish or other languages depending on account settings. Always check for both language labels
- **Don't** assume a "Responder" click opens a top-level comment editor — it opens a reply to the specific comment it belongs to. To post a top-level comment in a megathread, click the "Responder" button on the megathread post itself (not on an existing comment)

## agent-browser notes (verified 2026-10-24)
- Eval `() => expr` returns `{}` — wrap in an IIFE `(() => expr)()`.
- Polls: add a null-check `document.body && ...` after open (initial JS challenge).
- `save-state`/`load-state` do not exist — the session persists in `.browser-profile/`.
- Per-comment "Responder" lives inside the shadow DOM of `shreddit-comment` — normal qSA cannot reach it; pierce via `c.shadowRoot` or click via snapshot refs.
- Headless can get stuck on `?js_challenge=1` — use `--headed` if it appears.
- Missing session: posting/commenting flows require manual login.
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall