Skip to content

Instantly share code, notes, and snippets.

@jmanhype
Created February 4, 2026 16:56
Show Gist options
  • Select an option

  • Save jmanhype/c8e523901c07683abd201b84dc98a38b to your computer and use it in GitHub Desktop.

Select an option

Save jmanhype/c8e523901c07683abd201b84dc98a38b to your computer and use it in GitHub Desktop.
Guide for automating Facebook video uploads with agent-browser

Automating Facebook Video Uploads with agent-browser

Facebook uses hidden <input type="file"> elements that are triggered by stylized UI components. To automate video uploads using the agent-browser CLI, follow this workflow.

1. Identify the Hidden Input

Facebook often has multiple hidden file inputs for different media types. Use eval to find the one that accepts video formats (look for video/* or specific extensions like matroska/mp4).

agent-browser eval "Array.from(document.querySelectorAll('input[type=file]')).map(i => i.accept)"

2. The Upload Workflow

Step A: Open the Composer

Navigate to the group or profile and click the "Write something..." or "Photo/video" button to open the post dialog.

agent-browser click "@e70" # Ref for 'Write something...'

Step B: Direct Upload

Use the upload command targeting the input's accept attribute. agent-browser can interact with these inputs even if they are visually hidden (0x0 size).

# Target the input that handles video formats
agent-browser upload "input[accept*='matroska']" your_video.mp4

Step C: Wait for Attachment

Facebook needs a few seconds to process the file and enable the "Post" button.

agent-browser wait 5000

Step D: Add Caption & Post

Once the video is attached, the "Post" button becomes active.

agent-browser fill "@e16" "Your caption goes here! 🚀"
agent-browser click "@e26" # The 'Post' button

Summary Command Sequence

agent-browser open https://www.facebook.com/groups/your_group_id
agent-browser click @e70 
agent-browser upload "input[accept*='matroska']" video.mp4
agent-browser wait 5000
agent-browser fill @e16 "Automated Post!"
agent-browser click @e26

Generated by Gemini CLI using agent-browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment