Skip to main content

Mobile Browser Testing with Selenium

TestingBot lets you run Selenium WebDriver tests against mobile Safari on iOS (iPhone and iPad) and mobile Chrome on Android, on both simulators/emulators and real physical devices in our EU data centre. Mobile sessions are routed through Appium automatically; no separate Appium install needed on your side.

Looking for native app testing instead of mobile browsers? See App Automate for Appium, XCUITest, Espresso and Maestro on real devices.

Configuring capabilities

TestingBot's mobile simulators and emulators can be accessed using Appium. You can use the device picker below to select the capabilities you want to use for your tests.

MutableCapabilities capabilities = new MutableCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "safari");
capabilities.setCapability(CapabilityType.BROWSER_VERSION, "18.6");
capabilities.setCapability("appium:deviceName", "iPhone 16");
capabilities.setCapability(CapabilityType.PLATFORM_NAME, "iOS");
            

You can configure more options by using the Appium capabilities generator.

Portrait/Landscape

It's possible to rotate the device before and during your test. Please see these examples:

Set orientation before test (capability):
caps = {
  platformName: "iOS",
  "appium:deviceName": "iPhone 15",
  "appium:orientation": "LANDSCAPE"  # or PORTRAIT
}
Rotate during test:
((AppiumDriver) driver).rotate(ScreenOrientation.LANDSCAPE);

Specifying Appium Version

TestingBot will use the most recent, compatible, Appium version according to the device, OS and version you specify.

If you'd like to specify your own Appium version, you can do this with the appiumVersion capability.

To learn more about the available Appium versions, please see our Appium versions documentation.

Pass the appiumVersion capability inside tb:options. The examples below target an iPhone running mobile Safari, for Android Chrome change platformName to "Android", browserName to "chrome", and pick an Android deviceName.

XCUITestOptions options = new XCUITestOptions();
options.setPlatformName("iOS");
options.setDeviceName("iPhone 16");
options.setPlatformVersion("18.6");
options.setBrowserName("safari");

Map<String, Object> tbOptions = new HashMap<>();
tbOptions.put("key", "API_KEY");
tbOptions.put("secret", "API_SECRET");
tbOptions.put("appiumVersion", "2.4.1");
options.setCapability("tb:options", tbOptions);

IOSDriver driver = new IOSDriver(
    new URL("https://hub.testingbot.com/wd/hub"), options);
from appium import webdriver
from appium.options.ios import XCUITestOptions

options = XCUITestOptions()
options.platform_name = "iOS"
options.device_name = "iPhone 16"
options.platform_version = "18.6"
options.browser_name = "safari"
options.set_capability("tb:options", {
    "key": "API_KEY",
    "secret": "API_SECRET",
    "appiumVersion": "2.4.1"
})

driver = webdriver.Remote("https://hub.testingbot.com/wd/hub", options=options)
const { remote } = require('webdriverio');

const driver = await remote({
  hostname: 'hub.testingbot.com',
  port: 443,
  protocol: 'https',
  path: '/wd/hub',
  user: 'API_KEY',
  key:  'API_SECRET',
  capabilities: {
    platformName: 'iOS',
    browserName:  'safari',
    'appium:deviceName':      'iPhone 16',
    'appium:platformVersion': '18.6',
    'tb:options': {
      appiumVersion: '2.4.1'
    }
  }
});
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.iOS;

var options = new AppiumOptions();
options.PlatformName = "iOS";
options.BrowserName  = "safari";
options.AddAdditionalAppiumOption("deviceName",      "iPhone 16");
options.AddAdditionalAppiumOption("platformVersion", "18.6");
options.AddAdditionalAppiumOption("tb:options", new Dictionary<string, object>
{
    ["key"] = "API_KEY",
    ["secret"] = "API_SECRET",
    ["appiumVersion"] = "2.4.1"
});

var driver = new IOSDriver(
    new Uri("https://hub.testingbot.com/wd/hub"), options);
require 'appium_lib'

caps = {
  caps: {
    platformName: 'iOS',
    browserName:  'safari',
    'appium:deviceName':      'iPhone 16',
    'appium:platformVersion': '18.6',
    'tb:options' => {
      'appiumVersion' => '2.4.1'
    }
  },
  appium_lib: {
    server_url: 'https://API_KEY:API_SECRET@hub.testingbot.com/wd/hub'
  }
}

driver = Appium::Driver.new(caps).start_driver
$capabilities = [
  'platformName' => 'iOS',
  'browserName'  => 'safari',
  'appium:deviceName'      => 'iPhone 16',
  'appium:platformVersion' => '18.6',
  'tb:options' => [
    'key'           => 'API_KEY',
    'secret'        => 'API_SECRET',
    'appiumVersion' => '2.4.1',
  ],
];

$driver = RemoteWebDriver::create(
  'https://hub.testingbot.com/wd/hub',
  $capabilities
);

Testing internal or staging mobile sites

Use the TestingBot Tunnel to run mobile-browser tests against websites that aren't publicly reachable (local dev servers, staging environments behind a VPN, internal QA sites). Start the tunnel with an identifier, then pass tunnelIdentifier in your tb:options capabilities so the mobile device routes traffic through your tunnel.

See the TestingBot Tunnel documentation for setup details on Java, Docker and command-line installs.

Next steps

Was this page helpful?

Looking for More Help?

Have questions or need more information?
You can reach us via the following channels: