Skip to main content

Overview

Bring a specific application window to the foreground and make it the active window for interactions.

Syntax

Parameters

string
required
Application name (e.g., 'Google Chrome', 'Microsoft Edge', 'Notepad')

Returns

Promise<string> - Result message

Examples

Common Applications

After Opening Applications

Best Practices

Focus before UI interactionsAlways focus the target application before interacting with its UI:
Wait after launching appsGive applications time to open before focusing:
Use exact application names
Application must be runningThe application must already be running. focusApplication() won’t launch applications, only bring existing windows to the foreground.

Use Cases

Common Application Names

Browsers

  • 'Google Chrome'
  • 'Microsoft Edge'
  • 'Mozilla Firefox'
  • 'Safari' (macOS)

Office Applications

  • 'Microsoft Word'
  • 'Microsoft Excel'
  • 'Microsoft PowerPoint'
  • 'Microsoft Outlook'

Development Tools

  • 'Visual Studio Code'
  • 'Visual Studio'
  • 'IntelliJ IDEA'
  • 'Sublime Text'

System Applications

  • 'Notepad'
  • 'File Explorer'
  • 'Command Prompt'
  • 'Windows PowerShell'
  • 'Task Manager'

Communication

  • 'Microsoft Teams'
  • 'Slack'
  • 'Discord'
  • 'Zoom'

Complete Example

  • exec() - Launch applications with PowerShell
  • pressKeys() - Use Alt+Tab to switch windows
  • find() - Locate elements in the focused window