Hide Sensitive Data

You can prevent sensitive test data from appearing in the logs in Automate.


To execute some test scenarios, you use commands that send or retrieve data like email ID, cookies, credentials, etc. to or from remote browsers. In Automate, this data may appear in session logs, text, video, screenshots, and Selenium or Appium logs.

This guide shows you how to prevent this data from appearing in the session logs by:

  1. Masking values in text and raw session logs.
  2. Disabling specific logs (video, visual, and Selenium or Appium logs).

Masking sensitive data in text and raw logs

BrowserStack’s maskCommands capability hides data that you send to or retrieve from the remote browsers through the following commands:

Capability Value
Use this capability to mask the data sent or retrieved by certain commands.

Note: You can pass multiple commands in a single array, separated by commas.
Default: Empty Array

All the text sent via sendKeys command will be redacted.

All the text retrieved via get command will be redacted.

All the cookies which are set by the addCookie command will be redacted.

All the cookie values obtained using the getCookies and getCookieNamed command will be redacted.


The following sample shows how to configure your Selenium or Appium tests using browserstack.maskCommands capability:

caps.setCapability("browserstack.maskCommands", "setValues, getValues, setCookies, getCookies");
capabilities['browserstack.maskCommands'] = 'setValues, getValues, setCookies, getCookies'
caps.SetCapability("browserstack.maskCommands", "setValues, getValues, setCookies, getCookies");
$caps["browserstack.maskCommands"] = "setValues, getValues, setCookies, getCookies";
caps["browserstack.maskCommands"] = "setValues, getValues, setCookies, getCookies"
caps["browserstack.maskCommands"] = "setValues, getValues, setCookies, getCookies"
$caps->{"browserstack.maskCommands"} = "setValues, getValues, setCookies, getCookies";

This will replace all keystrokes and other values with REDACTED in your Automate session logs (text and raw). browserstack automate hide sensitive data

Disable specific logs

Apart from text and raw session logs, BrowserStack Automate also has videos, visuals, and the standard Selenium or Appium logs. These logs can not be masked.

To prevent sensitive information from appearing in these logs, you’ll need to disable them individually.

Disabling video logs

By default, video logs are enabled for all Automate sessions. Use the following capability to disable it.

Capability Value
Use this capability to enable or disable video log of your Automate test.
true, false
Default: true

The sample below shows how to use browserstack.video capability to disable video recording in your test:

caps.setCapability("browserstack.video", "false");
caps["browserstack.video"] = "false"
caps.SetCapability("browserstack.video", "false");
caps["browserstack.video"] = "false"
var capabilities = {
  'browserstack.video' : 'false'
$caps["browserstack.video"] = "false";
$caps->{"browserstack.video"} = "false";

Disabling visual logs (screenshots)

BrowserStack provides a visual log for Automate sessions. These are screenshots generated at different steps in your test script.

To prevent sensitive information from getting captured in these screenshots, make sure that visual logs are disabled. If not, set the browserstack.debug capability to false.

Capability Value
Use this capability to enable or disable visual log in your Automate session.
true, false
Default: false

The sample below shows how to use browserstack.debug capability to disable visual log in your test:

caps.setCapability("browserstack.debug", "false");
caps["browserstack.debug"] = "false"
caps.SetCapability("browserstack.debug", "false");
caps["browserstack.debug"] = "false"
var capabilities = {
  'browserstack.debug' : 'false'
$caps["browserstack.debug"] = "false";
$caps->{"browserstack.debug"} = "false";

Disabling the Selenium or Appium logs

For every Automate session, you get Selenium or Appium logs by default. However, these logs can not be masked.

You can disable Selenium or Appium logs by using the following capabilities:

Capability Value
Use this capability to disable selenium logs for your desktop browser tests.
true, false
Default: true
Use this capability to disable appium logs for your tests.
true, false
Default: true

The sample below shows how to disable browserstack.seleniumLogs and browserstack.appiumLogs capabilities for your test:

caps.setCapability("browserstack.seleniumLogs", "false");
caps.setCapability("browserstack.appiumLogs", "false");
caps["browserstack.seleniumLogs"] = "false"
caps["browserstack.appiumLogs"] = "false"
caps.SetCapability("browserstack.seleniumLogs", "false");
caps.SetCapability("browserstack.appiumLogs", "false");
caps["browserstack.seleniumLogs"] = "false"
caps["browserstack.appiumLogs"] = "false"
capabilities['browserstack.seleniumLogs'] = 'false';
capabilities['browserstack.appiumLogs'] = 'false';
$caps["browserstack.seleniumLogs"] = "false";
$caps["browserstack.appiumLogs"] = "false";
$caps->{"browserstack.seleniumLogs"} = "false";
$caps->{"browserstack.appiumLogs"} = "false";

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked

Thank you for your valuable feedback