Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & App Percy

Accept insecure certificates

Use the accept insecure certificates capability to avoid invalid certificate errors when using a self-signed certificate to test your app:

If you are using BrowserStack SDK, you can set the following capability within the browserstack.yml file:

Capability Description Expected values
acceptInsecureCerts Avoid invalid certificate errors while your test is running true/false Default: false
browserstack.yml
Copy icon Copy snippet

BrowserStack SDK is a plug-n-play solution that takes care of all the integration steps for you. Using the BrowserStack SDK is the recommended integration method for your project. To know more, visit the SDK core concepts page.

Use the following code snippet to accept insecure certificates:

Capability Description Expected values
acceptInsecureCerts Avoid invalid certificate errors while your test is running true/false Default: false

Example:

DesiredCapabilities capabilities = new DesiredCapabilities();
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
browserstackOptions.put("acceptInsecureCerts", "true");
var capabilities = {
	'bstack:options' : {
		"acceptInsecureCerts" : "true",
	},
}
AppiumOptions capabilities = new AppiumOptions();
Dictionary<string, object> browserstackOptions = new Dictionary<string, object>();
browserstackOptions.Add("acceptInsecureCerts", "true");
$caps = array(
    'bstack:options' => array(
        "acceptInsecureCerts" => "true",
    ),
)
desired_cap = {
	'bstack:options' : {
		"acceptInsecureCerts" : "true",
	},
}
capabilities = {
    'bstack:options' => {
        "acceptInsecureCerts" => "true",
    },
}
Capability Description Expected values
browserstack.acceptInsecureCerts Avoid invalid certificate errors while your test is running true/false Default: false

Example:

DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("browserstack.acceptInsecureCerts", "true");
var capabilities = {
	'browserstack.acceptInsecureCerts': 'true'
}
DesiredCapabilities capability = new DesiredCapabilities();
capability.SetCapability("browserstack.acceptInsecureCerts", "true");
$capabilities = new DesiredCapabilities();
$capabilities->setCapability("browserstack.acceptInsecureCerts", "true");
desired_cap = {
	'browserstack.acceptInsecureCerts': 'true'
}
desired_caps = {
    'browserstack.acceptInsecureCerts': 'true'
}

This feature is supported on all devices except the devices listed here under the Capabilities Reference section.

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

Is this page helping you?

Yes
No

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!

Talk to an Expert
Download Copy