testdriverfocus-applicationlisted
Install: claude install-skill testdriverai/testdriverai
<!-- Generated from focus-application.mdx. DO NOT EDIT. -->
## Overview
Bring a specific application window to the foreground and make it the active window for interactions.
## Syntax
```javascript
await testdriver.focusApplication(name)
```
## Parameters
<ParamField path="name" type="string" required>
Application name (e.g., `'Google Chrome'`, `'Microsoft Edge'`, `'Notepad'`)
</ParamField>
## Returns
`Promise<string>` - Result message
## Examples
### Common Applications
```javascript
// Focus Chrome browser
await testdriver.focusApplication('Google Chrome');
// Focus Edge browser
await testdriver.focusApplication('Microsoft Edge');
// Focus Notepad
await testdriver.focusApplication('Notepad');
// Focus File Explorer
await testdriver.focusApplication('File Explorer');
// Focus Visual Studio Code
await testdriver.focusApplication('Visual Studio Code');
```
### After Opening Applications
```javascript
// Open Chrome and focus it
await testdriver.exec('pwsh', `
Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "https://example.com"
`, 5000);
await new Promise(r => setTimeout(r, 2000)); // Wait for launch
// Focus the Chrome window
await testdriver.focusApplication('Google Chrome');
```
## Best Practices
<Check>
**Focus before UI interactions**
Always focus the target application before interacting with its UI:
```javascript
await testdriver.focusApplication('Google Chrome');
const button = await testdr