X (Twitter) Video Post
Posts a video with accompanying text to X. Uses Playwright for navigation and text entry, then switches entirely to macOS-use for file upload and posting.
Critical difference from LinkedIn: You MUST close the Playwright browser connection before triggering the file upload, or the native dialog will not appear.
Prerequisites
- Chrome logged into X (Twitter)
- Video file exists at an absolute path on disk
- Post text prepared
Step-by-Step Workflow
Phase 1: Type Post Text (Playwright)
- Navigate to X home:
browser_navigate → https://x.com/home - Take a snapshot to find the composer
- Click the "What is happening?!" text area to focus it
- Type the post text into the composer
Phase 2: Close Playwright (Critical!)
- Close Playwright browser connection:
This is mandatory — Playwright's CDPbrowser_closefileChooserOpenedlistener will intercept the file dialog event and prevent the native macOS dialog from appearing. The typed text will persist in Chrome after closing Playwright.
Phase 3: Upload Video (macOS-use)
- Get Chrome PID:
pgrep -x "Google Chrome" - Use
click_and_traverseon the media upload icon (image/video icon in composer toolbar)- Grep traversal for media-related buttons or icons
- It's typically an image icon in the bottom toolbar of the composer
- Wait for native file dialog (AXSheet) to appear
- Grep traversal for
AXSheetto confirm
- Grep traversal for
- Press
Cmd+Shift+Gviapress_key_and_traverseto open "Go to folder" - Type the absolute video file path via
type_and_traverse - Press
Returnviapress_key_and_traverse - Grep traversal for
"Open"button (AXButton near bottom of AXSheet, y > 1500) - Click "Open" via
click_and_traverse
Phase 4: Wait for Upload & Post (macOS-use)
- Wait for video upload to complete — X shows upload progress
- Look for "Uploaded (100%)" or similar completion indicator
- Large videos may take 30-60+ seconds
- Periodically
refresh_traversaland grep for upload status
- Once upload complete, click "Post" button via
click_and_traverse- Grep traversal for "Post" AXButton
Troubleshooting
- File dialog doesn't appear: Most likely Playwright is still connected. Ensure you called
browser_closebefore clicking the media button with macOS-use. - Text disappeared after browser_close: This shouldn't happen — Chrome keeps the page state. If it does, re-type via macOS-use
type_and_traverse. - Upload progress stuck: Large videos take time. Wait and check. If truly stuck, try re-selecting the file.
- "Post" button grayed out: Video may still be processing. Wait for upload completion indicator.
- Can't find media button: Traverse Chrome window and grep for image/photo/media related accessibility labels. The button is in the composer toolbar row.