---
title: JavaScript Executor Commands (tb:) | TestingBot
description: 'Reference of every tb: JavaScript executor command on TestingBot, with
  the platforms each one works on: Windows, macOS, Linux, Android emulators, iOS simulators
  and real devices.'
source_url:
  html: https://testingbot.com/support/other/executor-commands
  md: https://testingbot.com/support/other/executor-commands.md
---

# JavaScript Executor Commands

TestingBot adds custom commands to the WebDriver `executeScript` (JavaScript executor) call. A script that starts with `tb:` is not run in the browser: TestingBot handles it and answers it, so you can report a test result, throttle the network or restart an app from inside your Selenium or Appium test.

This page lists every `tb:` command and the platforms it works on. Where a command has its own page with more examples, the table links to it.

## How to send a command

Pass the command as the script, and its arguments (if any) as the script arguments:

```javascript
// Selenium / WebdriverIO (JavaScript)
await driver.executeScript('tb:test-result=passed', []);
await driver.executeScript('tb:throttle', ['3G']);
await driver.executeScript('tb:geo', [{ code: 'DE' }]);
```

```python
# Python
driver.execute_script("tb:test-name=Checkout flow")
driver.execute_script("tb:locale", {"locale": "fr", "country": "FR"})
```

Some commands put their value in the script itself (`tb:test-name=My test`), others take an object as the first argument (`tb:geo` with `{ code: 'DE' }`). The tables below show which form each command uses.

These commands work in Selenium and Appium (WebDriver) sessions. Playwright and Puppeteer sessions report results in their own way: see [Playwright test results](https://testingbot.com/support/web-automate/playwright/test-results) and [Puppeteer test results](https://testingbot.com/support/web-automate/puppeteer/test-results).

## Test details and results

These commands change the test's details in your TestingBot dashboard. They work on every platform: desktop browsers, emulators, simulators and real devices.

| Command | What it does | More |
| --- | --- | --- |
| `tb:test-result=passed` `tb:test-result=failed` | Marks the test as passed or failed. `true` and `false` work too. | [Test Result](https://testingbot.com/support/web-automate/selenium/annotating-tests#testresult) |
| `tb:test-name=...` | Sets the test's name. | [Test Name](https://testingbot.com/support/web-automate/selenium/annotating-tests#test-name) |
| `tb:test-build=...` | Adds the test to the build with this name, and creates the build if it does not exist yet. | [Test Build](https://testingbot.com/support/web-automate/selenium/annotating-tests#testbuild) |
| `tb:test-tags=tag1,tag2` | Adds comma-separated tags to the test. | [Test Tags](https://testingbot.com/support/web-automate/selenium/annotating-tests#testtags) |
| `tb:test-project=...` | Files the test under the project with this name. The test's build is filed under it too, if that build has no project yet. The value may be URL-encoded. | [Test Info](https://testingbot.com/support/web-automate/selenium/annotating-tests#testinfo) (the `project` field does the same) |
| `tb:test-context=...` | Adds a step with this text to the test's log, for example to mark where a test phase starts. | [Test Context](https://testingbot.com/support/web-automate/selenium/annotating-tests#testcontext) |
| `tb:test-info={...}` | Sets several details at once from a JSON object: `name`, `status_message`, `public`, `extra`, `build` and `project`. | [Test Info](https://testingbot.com/support/web-automate/selenium/annotating-tests#testinfo) |
| `tb:session-details` | Returns an object describing the running session: `sessionId`, `testId`, `name`, `build`, `status` (`passed`, `failed` or `unknown`), `statusMessage`, `browserName`, `browserVersion`, `platform`, `deviceName`, `realDevice`, `startTime` and `url` (the test's page in the dashboard). It never contains your credentials. | — |
| `tb:break` | Pauses the test at this point. Open the test in your dashboard to take over the session with mouse and keyboard. | [Break test](https://testingbot.com/support/web-automate/selenium/annotating-tests#testbreak) |
| `tb:visual.snapshot=...` `tb:visual.baseline=...` | Takes a visual snapshot and compares it with the baseline, or sets a new baseline. | [Visual testing with Selenium](https://testingbot.com/support/visual-testing/automated/selenium), [with Appium](https://testingbot.com/support/visual-testing/automated/appium) |

## Browser and device commands

These commands act on the machine or device that runs your test, so each one works on some platforms only. **Yes** means the command works there; on the other platforms it returns an error or has no effect.

| Command | Arguments | Windows | macOS | Linux | Android emulator | iOS simulator | Real Android | Real iOS |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| `tb:throttle` [Network throttling](https://testingbot.com/support/web-automate/selenium/network) [Notes](https://testingbot.com#note-throttle) | `'3G'` or `{ downloadSpeed, uploadSpeed, latency, loss }` | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| `tb:geo` [Geolocation](https://testingbot.com/support/web-automate/selenium/test-options#geo) [Notes](https://testingbot.com#note-geo) | `{ code: 'DE' }` | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| `tb:locale` [Localization](https://testingbot.com/support/app-automate/appium/localization-options) [Notes](https://testingbot.com#note-locale) | `{ locale: 'fr', country: 'FR' }` | — | — | — | Yes | — | Yes | — |
| `tb:setTimezone` [Device timezone](https://testingbot.com/support/app-automate/appium/options#timezone) [Notes](https://testingbot.com#note-timezone) | `{ timezone: 'America/New_York' }` | — | — | — | — | — | Yes | Yes |
| `tb:restartApp` [Notes](https://testingbot.com#note-apps) | none | — | — | — | Yes | Yes | Yes | Yes |
| `tb:killApp` [Notes](https://testingbot.com#note-apps) | none | — | — | — | Yes | Yes | Yes | Yes |
| `tb:homeScreen` [Notes](https://testingbot.com#note-apps) | none | — | — | — | Yes | Yes | Yes | Yes |
| `tb:talkBack` [Screen readers](https://testingbot.com/support/app-live/screen-reader) [Notes](https://testingbot.com#note-screen-reader) | `{ enabled: true }` or `{ enabled: false }` | — | — | — | Yes | — | Yes | — |
| `tb:voiceOverStarttb:voiceOverStop` [Screen readers](https://testingbot.com/support/app-live/screen-reader) [Notes](https://testingbot.com#note-screen-reader) | none | Yes | Yes | — | Yes | — | Yes | — |
| `tb:a11ySettings` [Notes](https://testingbot.com#note-a11y-settings) | `{ fontScale, displaySize, boldText, highContrastText, animations }` | — | — | — | Yes | — | Yes | — |
| `tb:emulatorControls` [Notes](https://testingbot.com#note-emulator-controls) | `{ batteryLevel, charging, signal, mobileData, microphone, fingerprint }` | — | — | — | Yes | — | — | — |
| `tb:intercept` [Network interception](https://testingbot.com/support/web-automate/selenium/network) [Notes](https://testingbot.com#note-chrome-debug) | interception rules | Yes | Yes | Yes | — | — | — | — |
| `tb:network` [Network logs](https://testingbot.com/support/web-automate/selenium/network) [Notes](https://testingbot.com#note-chrome-debug) | none | Yes | Yes | Yes | — | — | — | — |
| `tb:performance` [Performance metrics](https://testingbot.com/support/web-automate/selenium/performance) [Notes](https://testingbot.com#note-chrome-debug) | none | Yes | Yes | Yes | — | — | — | — |
| `tb:accessibility` [Accessibility testing](https://testingbot.com/support/accessibility/web/selenium) [Notes](https://testingbot.com#note-accessibility) | none | Yes | Yes | Yes | — | — | — | — |
| `tb:fileExiststb:filePropertiestb:fileContent` [File downloads](https://testingbot.com/support/web-automate/selenium/test-file-downloads) [Notes](https://testingbot.com#note-downloads) | `{ fileName: 'report.pdf' }` | Yes | Yes | Yes | — | — | — | — |
| `tb:autoit` [AutoIt](https://testingbot.com/support/web-automate/selenium/auto-it) | AutoIt script | Yes | — | — | — | — | — | — |
| `tb:osascript` [AppleScript](https://testingbot.com/support/web-automate/selenium/osascript) | `{ script, timeout }` | — | Yes | — | — | — | — | — |
| `tb:getExtensionId` [Browser extensions](https://testingbot.com/support/web-automate/selenium/browser-extension) [Notes](https://testingbot.com#note-extension) | none | — | Yes | — | — | — | — | — |
| `tb:swipeDown` [Notes](https://testingbot.com#note-swipe) | none | — | — | — | Yes | — | — | — |

## Notes per command

### tb:throttle

Pass a preset name (`airplane`, `edge`, `3G` or `4G`) or your own speeds. `disable` removes the throttle again. See [Network throttling](https://testingbot.com/support/web-automate/selenium/network) for the presets and examples.

### tb:geo

Routes the session's traffic through a location in the country you pass, as a two-letter uppercase country code. Use a code from the [geolocation list](https://testingbot.com/support/web-automate/selenium/test-options#geo). This changes the IP address websites see; to change the GPS position of a device, use your framework's location command instead.

### tb:locale

Changes the language and region of an Android emulator or real Android device while the test runs. To start a test in a language on any platform, use the capabilities on [Localization testing on iOS and Android](https://testingbot.com/support/app-automate/appium/localization-options).

### tb:setTimezone

Changes the time zone of a real device while the test runs. Pass an IANA time zone name such as `America/New_York` or `Europe/Paris`. The time zone is reset after the session. To start a test in a time zone, use the [timeZone capability](https://testingbot.com/support/app-automate/appium/options#timezone).

### tb:restartApp, tb:killApp and tb:homeScreen

`tb:killApp` stops the app under test, `tb:restartApp` stops it and starts it again, and `tb:homeScreen` goes to the device's home screen and leaves the app running in the background. They act on the app you started the session with.

### tb:talkBack, tb:voiceOverStart and tb:voiceOverStop

- On Android emulators and real Android devices, all three commands turn TalkBack on or off. On emulators, TalkBack is available from Android 14 (API 34).
- On Windows, `tb:voiceOverStart` starts the NVDA screen reader; on macOS it starts VoiceOver.
- In an iOS simulator session these commands do not control VoiceOver inside the simulator. Real iOS devices do not support them.

See [Screen Reader Testing](https://testingbot.com/support/app-live/screen-reader) for how the screen readers behave on TestingBot devices.

### tb:a11ySettings

Changes the display and accessibility settings of an Android emulator or real Android device. Pass any of these keys; pass no argument to only read the current settings. The command answers with the settings after the change, and the device gets its own settings back at the end of the session.

- `fontScale`: `small`, `default`, `large`, `larger`, `largest` or `huge`
- `displaySize`: `small`, `default`, `large`, `larger` or `largest`
- `boldText`: `true` or `false` (Android 12 and newer)
- `highContrastText`: `true` or `false`
- `animations`: `false` turns off window, transition and animator animations

```javascript
await driver.executeScript('tb:a11ySettings', [{ fontScale: 'largest', boldText: true }]);
```

### tb:emulatorControls

Changes the simulated hardware of an Android emulator. Pass any of these keys; pass no argument to only read the current state. The command answers with the state after the change.

- `batteryLevel`: 0 to 100
- `charging`: `true` or `false`
- `signal`: `none`, `poor`, `moderate`, `good` or `great`
- `mobileData`: `true` or `false`. The emulator stays online over Wi-Fi; this changes what apps see for the cellular network.
- `microphone`: `false` blocks microphone access for every app (Android 12 and newer)
- `fingerprint`: `match` touches the sensor with an enrolled finger, `nomatch` with an unknown one. Set a screen lock and enroll a fingerprint first.

```javascript
await driver.executeScript('tb:emulatorControls', [{ batteryLevel: 15, charging: false, signal: 'poor' }]);
```

### tb:intercept, tb:network and tb:performance

These need the `debugging` capability set to `true`, and work with Chrome and Microsoft Edge on desktop. Without it, they answer with a message that asks you to add the capability.

### tb:accessibility

Runs an accessibility scan (axe-core) on the page that is open in the browser and returns the results. Frames inside the page are not scanned.

### tb:fileExists, tb:fileProperties and tb:fileContent

Check a file the browser downloaded during the test: whether it exists, its size, timestamps and MD5 checksum, or its content. See [Test file downloads](https://testingbot.com/support/web-automate/selenium/test-file-downloads).

### tb:getExtensionId

Returns the identifier of the extension you loaded with the `load-extension` capability. It works for Safari extensions on macOS.

### tb:swipeDown

Performs one swipe gesture on an Android emulator to scroll the page, for example to hide the browser's address bar.

## Looking for more help?

Have questions or need more information? Reach out via email or Slack.

[Email us](https://testingbot.com/contact/new) [Join our Slack](https://join.slack.com/t/testingb0t/shared_invite/zt-3bcw9xch-jk19~6XPs_xBrsAgAedkCw)
