Skip to main content
Electron apps include Slack, Discord, VS Code, Notion, Figma, and many other popular desktop applications.

Why Electron apps are different

Electron apps expose a minimal Accessibility tree compared to native macOS apps. Inner UI elements often appear as opaque AXGroup elements with no labels or structure, making traditional AX-based automation challenging. When you run snapshot -i on an Electron app, you may see very few interactive elements:
This minimal tree structure means you need alternative automation strategies.

Automation strategies

Use keyboard shortcuts

Most Electron apps have rich keyboard support. This is the primary method for automating Electron apps.
1

Identify available shortcuts

Check the app’s menu bar or documentation for keyboard shortcuts. Common patterns:
  • Cmd+K: Quick switcher (Slack, Discord, VS Code)
  • Cmd+N: New window/message
  • Cmd+T: New tab
  • Cmd+W: Close window/tab
  • Cmd+F: Search
2

Send keystrokes with agent-native

Use the key command to send keyboard shortcuts:
See KeyCommand.swift:36-44 for implementation details.
3

Chain commands for complex workflows

Combine multiple keystrokes to accomplish tasks:

Use screenshots for visual context

When the AX tree doesn’t provide enough information, capture screenshots to understand what’s on screen:
The screenshot command captures the app’s frontmost window (see ScreenshotCommand.swift:29-42):
Use screenshots to verify navigation state before and after keyboard actions.

Check window titles

The window title often reflects the current navigation state:
This is useful for:
  • Confirming successful navigation
  • Determining which channel or conversation is active
  • Verifying modal states

Paste files

For file uploads, use the paste command to copy a file to the clipboard and paste it:
This is equivalent to:
  1. Copying the file to the clipboard
  2. Sending Cmd+V to the app
See SKILL.md:60-67 for the paste command details.

Example: Automating Slack

Here’s a complete workflow for sending a message with an image to a Slack channel:
1

Open and activate Slack

2

Navigate to the channel

3

Verify navigation

4

Type message

5

Paste image

6

Send message

Common keyboard shortcuts

Slack

VS Code

Discord

Best practices

Always re-snapshot or verify state after navigation actions. Electron app states change frequently, and keyboard shortcuts may have unexpected effects.

Use delays between actions

Add small delays between rapid keystrokes to ensure the app processes each action:

Verify with screenshots

Capture screenshots before and after actions to debug automation failures:

Check window titles

Use window titles to confirm navigation:

Test shortcuts manually

Verify keyboard shortcuts work manually before automating them.

Troubleshooting

Possible causes:
  • App is not focused/activated
  • Shortcut requires different modifiers on your system
  • App has custom keybindings
Solutions:
  1. Ensure the app is activated:
  2. Check the app’s keyboard shortcuts in Preferences
  3. Try alternative shortcuts (e.g., cmd+shift+k instead of cmd+k)
Possible causes:
  • Special characters require escaping
  • App processes input asynchronously
Solutions:
  1. Add delays between keystrokes:
  2. Use quotes for text with spaces or special characters:
Solutions:
  1. Use window titles:
  2. Use screenshots:
  3. Add delays to allow UI to update:

Next steps

System Settings

Automate System Settings and native macOS apps

Safari automation

Interact with web content in Safari