Change device settings on iOS devices
You can change the following settings on iOS devices:
Dark Mode
Dark mode is available only under Device Cloud Pro, Device Cloud Pro + Visual Cloud, and Enterprise Pro plans. This feature is not supported for Android devices. For more details check out our pricing page.
Dark Mode setting is the system-wide appearance that uses a dark interface background to enable better viewing in low-light conditions. The Dark Mode setting makes foreground content appear more vibrant in contrast to darker backgrounds.
You can test different scenarios for your app that supports dark mode by enabling the setting on remote BrowserStack iOS devices.
This guide helps you with:
Supported devices and OS
Devices | OS Version |
---|---|
iPhones and iPads | iOS 13 and above |
Enable dark mode setting using a capability
Use the following capability in your test scripts.
If you are using BrowserStack SDK, you can set the following capability within the browserstack.yml
file:
Capability | Description |
---|---|
updateIosDeviceSettings |
Set darkMode configuration to "true" inside the updateIosDeviceSettings capability to enable dark mode setting on the device |
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.
Capability | Description |
---|---|
updateIosDeviceSettings |
Set darkMode configuration to "true" inside the updateIosDeviceSettings capability to enable dark mode setting on the device |
Example:
DesiredCapabilities capabilities = new DesiredCapabilities();
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
HashMap<String, Boolean> options = new HashMap<>();
options.put("darkMode", true);
browserstackOptions.put("updateIosDeviceSettings", options);
capabilities.setCapability("bstack:options", browserstackOptions);
var capabilities = {
'bstack:options' : {
"updateIosDeviceSettings" : {
"darkMode" : "true"
}
}
}
AppiumOptions capabilities = new AppiumOptions();
Dictionary<string, object> browserstackOptions = new Dictionary<string, object>();
Dictionary<string, object> updateIosDeviceSettings = new Dictionary<string, object>();
updateIosDeviceSettings.Add("darkMode", "true");
browserstackOptions.Add("updateIosDeviceSettings", updateIosDeviceSettings);
capabilities.AddAdditionalCapability("bstack:options", browserstackOptions);
desired_cap = {
'bstack:options' : {
"updateIosDeviceSettings" : {
"darkMode" : "true"
}
}
}
capabilities = {
'bstack:options' => {
"updateIosDeviceSettings" => {
"darkMode" => "true"
}
}
}
Capability | Description |
---|---|
browserstack.updateIosDeviceSettings |
Set darkMode configuration to "true" inside the browserstack.updateIosDeviceSettings capability to enable dark mode setting on the device |
Example:
DesiredCapabilities caps = new DesiredCapabilities();
HashMap<String, Boolean> updateDeviceSettings = new HashMap<>();
updateDeviceSettings.put("darkMode", true);
caps.setCapability("browserstack.updateIosDeviceSettings", updateDeviceSettings);
var capabilities = {
"browserstack.updateIosDeviceSettings" : {
"darkMode" : "true"
}
}
AppiumOptions capabilities = new AppiumOptions();
Dictionary<string, object> updateIosDeviceSettings = new Dictionary<string, object>();
updateIosDeviceSettings.Add("darkMode","true");
capabilities.AddAdditionalCapability("browserstack.updateIosDeviceSettings", updateIosDeviceSettings);
desired_cap = {
"browserstack.updateIosDeviceSettings" : {
"darkMode" : "true"
}
}
capabilities = {
"browserstack.updateIosDeviceSettings" => {
"darkMode" => "true"
}
}
Location Services
You can turn location services ON or OFF on BrowserStack iOS devices while running an appium test session to test functionalities that are dependent on modifying the setting. App Automate supports this feature through an automated test script.
In this guide, you will learn about
- Supported devices and OS versions
- How to toggle location services via custom BrowserStack javascript executor
Supported devices and OS versions
The following table lists the devices and OS versions on which the feature is currently supported:
Devices | OS version |
---|---|
iPhones and iPads | v15 and above |
Toggle location services using custom BrowserStack executor
Set the action type as updateIosDeviceSettings
and set the input to the argument LocationServices
as ON
or OFF
in the BrowserStack JavaScript executor to enable or disable location services during the test session.
As an example, the following code snippet demonstrates how to use the BrowserStack JavaScript executor to disable location services:
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("browserstack_executor: {
\"action\":\"updateIosDeviceSettings\",
\"arguments\": {
\"LocationServices\" : \"OFF\"
}
}"
);
await driver.execute("browserstack_executor: {
\"action\":\"updateIosDeviceSettings\",
\"arguments\": {
\"LocationServices\" : \"OFF\"
}
}"
);
driver.execute_script("browserstack_executor: {
\"action\":\"updateIosDeviceSettings\",
\"arguments\": {
\"LocationServices\" : \"OFF\"
}
}"
);
caps["javascriptEnabled"] = "true" #include this capability for JavaScript Executors to work
driver.execute_script("browserstack_executor: {
\"action\":\"updateIosDeviceSettings\",
\"arguments\": {
\"LocationServices\" : \"OFF\"
}
}"
);
((IJavaScriptExecutor)driver).ExecuteScript("browserstack_executor: {
\"action\":\"updateIosDeviceSettings\",
\"arguments\": {
\"LocationServices\" : \"OFF\"
}
}"
);
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
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!