The
provision methods focus the app they launch, so you donβt need this right after provision.chrome(), provision.vscode(), provision.electron(), or provision.installer().Signature
Parameters
string
required
The appβs name, as it appears in its window title. For example
'Google Chrome', 'Notepad', or 'Visual Studio Code'.object
Returns
Promise<string>. Always resolves to "The application was focused.".
Errors
focusApplication() doesnβt throw when no window matches. It returns the same message either way.
To confirm the right app is in front, follow it with an assert():
How it matches windows
- Windows: TestDriver looks for windows whose title contains
name. It restores a minimized window, then brings it to the front. - Linux: TestDriver runs
jumpapp -f <name>. If that fails, it activates the first window whose title matchesname, usingxdotool.
provision or exec().
Examples
Switch between two apps
Launch an app and focus it on Windows
Return to the browser after a dialog
Complete example
tests/notepad.test.mjs
Related
- Launch apps: open an app and focus it in one step
- exec(): start an app with a shell command
- pressKeys(): switch windows with keyboard shortcuts

