testdriver-agent
How the TestDriver agent behaves on GitHub issues, pull requests, and @mentions
Bring an application window to the foreground
$ npx -y skills add testdriverai/testdriverai --skill testdriver-focus-application --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/testdriver-focus-applicationContext preview
The summary Claude sees to decide when to auto-load this skill.
Bring an application window to the foreground
name: testdriver:focus-application description: Bring an application window to the foreground
<!-- Generated from focus-application.mdx. DO NOT EDIT. -->
Move a specific application window to the front. Make it the active window for interactions.
await testdriver.focusApplication(name)
<ParamField path="name" type="string" required> The application name (for example, `'Google Chrome'`, `'Microsoft Edge'`, `'Notepad'`) </ParamField>
`Promise<string>` - The result message
// 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');// 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');<Check> **Focus before UI interactions**
Always focus the target application before interacting with its UI:
await testdriver.focusApplication('Google Chrome');
const button = await testdriver.find('submit button');
await button.click();</Check>
<Check> **Wait after launching apps**
Give applications time to open before focusing:
await testdriver.exec('pwsh', 'Start-Process notepad', 5000);
await new Promise(r => setTimeout(r, 1000)); // Wait for launch
await testdriver.focusApplication('Notepad');</Check>
<Check> **Use exact application names**
// ✅ Correct
await testdriver.focusApplication('Google Chrome');
// ❌ May not work
await testdriver.focusApplication('Chrome');
await testdriver.focusApplication('chrome.exe');</Check>
<Warning> **Application must be running**
The application must already be running. `focusApplication()` won't launch applications, only bring existing windows to the foreground. </Warning>
<AccordionGroup> <Accordion title="Multi-Application Testing">
// Test workflow across multiple apps
await testdriver.focusApplication('Google Chrome');
const data = await testdriver.extract('the order number');
await testdriver.focusApplication('Notepad');
await testdriver.type(data);
await testdriver.pressKeys(['ctrl', 's']);
await testdriver.focusApplication('Google Chrome');
const nextButton = await testdriver.find('next button');
await nextButton.click();</Accordion>
<Accordion title="Browser Switching">
// Compare behavior in different browsers
await testdriver.focusApplication('Google Chrome');
await testdriver.assert('page loaded correctly in Chrome');
await testdriver.focusApplication('Microsoft Edge');
await testdriver.assert('page loaded correctly in Edge');</Accordion>
<Accordion title="Desktop Application Testing">
// Launch and focus desktop app
await testdriver.exec('pwsh', 'Start-Process notepad', 5000);
await new Promise(r => setTimeout(r, 1000));
await testdriver.focusApplication('Notepad');
await testdriver.type('Test content');</Accordion>
<Accordion title="Window Management">
// Show desktop first
await testdriver.pressKeys(['winleft', 'd']);
// Click desktop icon
const icon = await testdriver.find('Chrome icon on desktop');
await icon.click();
await new Promise(r => setTimeout(r, 2000));
// Focus the opened window
await testdriver.focusApplication('Google Chrome');</Accordion> </AccordionGroup>
import { beforeAll, afterAll, describe, it } from 'vitest';
import TestDriver from 'testdriverai';
describe('Multi-Application Workflow', () => {
let testdriver;
beforeAll(async () => {
client = new TestDriver(process.env.TD_API_KEY);
await testdriver.auth();
await testdriver.connect();
});
afterAll(async () => {
await testdriver.disconnect();
});
it('should work across multiple applications', async () => {
// Start in browser
await testdriver.focusApplication('Google Chrome');
// Get data from web page
const orderNumber = await testdriver.extract('the order number');
console.log('Order:', orderNumber);
// Open Notepad
await testdriver.exec('pwsh', 'Start-Process notepad', 5000);
await new Promise(r => setTimeout(r, 1500));
// Focus Notepad and save data
await testdriver.focusApplication('Notepad');
await testdriver.type(`Order Number: ${orderNumber}`);
await testdriver.type('\n');
await testdriver.type(`Date: ${new Date().toISOString()}`);
// Save file
await testdriver.pressKeys(['ctrl', 's']);
await new Promise(r => setTimeout(r, 500));
await testdriver.type('C:\\order-info.txt');
awaiRepo: testdriverai/testdriverai
How the TestDriver agent behaves on GitHub issues, pull requests, and @mentions
Deploy TestDriver on your AWS infrastructure using CloudFormation
How TestDriver learns your app and caches what it discovers for instant, deterministic replays