mcpbeat Sign in

Testdriver:focus Application Agent Skill

Bring an application window to the foreground

2k tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
237
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/testdriverai/testdriverai --skill testdriver:focus-application

The instruction itself

17 sections, as written by the author

<!-- 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

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

// 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

// 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:

  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>

Use Cases

<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>

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

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');
    await testdriver.pressKeys(['enter']);
    
    // Return to browser
    await testdriver.focusApplication('Google Chrome');
    
    const confirmButton = await testdriver.find('confirm order button');
    await confirmButton.click();
    
    await testdriver.assert('order confirmed');
  });

  it('should switch between browser tabs', async () => {
    await testdriver.focusApplication('Google Chrome');
    
    // Open new tab
    await testdriver.pressKeys(['ctrl', 't']);
    await new Promise(r => setTimeout(r, 500));
    
    // Navigate to URL
    await testdriver.pressKeys(['ctrl', 'l']);
    await testdriver.type('https://example.com');
    await testdriver.pressKeys(['enter']);
    
    await new Promise(r => setTimeout(r, 2000));
    
    // Ensure Chrome is still focused
    await testdriver.focusApplication('Google Chrome');
    
    await testdriver.assert('example.com page is loaded');
  });

  it('should handle dialog boxes', async () => {
    await testdriver.focusApplication('Google Chrome');
    
    const deleteButton = await testdriver.find('delete account button');
    await deleteButton.click();
    
    await new Promise(r => setTimeout(r, 500));
    
    // Dialog appears - make sure it's focused
    await testdriver.focusApplication('Google Chrome');
    
    const confirmBtn = await testdriver.find('confirm deletion button');
    await confirmBtn.click();
  });
});
  • exec() - Launch applications with PowerShell
  • pressKeys() - Use Alt+Tab to switch windows
  • find() - Locate elements in the focused window

Other skills for the same job

different authors, same section of the catalogue
Protocolsio Integration
by christophacham
×4

Integration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io functionality into workflows. Applicable for protocol discovery, collaborative protocol development, experiment tracking, lab protocol management, and scientific documentation.

16k tokens
Tailored Resume Generator
by frostant
×4

Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances

3k tokens
Excalidraw Diagram Generator
by github
vendor ×3

Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.

36k tokens scripts
Expo Dev Client
by openai
vendor ×3

Build and distribute Expo development clients locally or via TestFlight

961 tokens
Executing Plans
by ZhanlinCui
×3

Use when you have a written implementation plan to execute in a separate session with review checkpoints

542 tokens
Anndata
by christophacham
×3

Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.

16k tokens
Benchling Integration
by christophacham
×3

Benchling R&D platform integration. Access registry (DNA, proteins), inventory, ELN entries, workflows via API, build Benchling Apps, query Data Warehouse, for lab data management automation.

14k tokens
Biopython
by christophacham
×3

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.

24k tokens

How to use it

Copy the folder

Take testdriverai/testdriver:focus-application from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.