Search code examples
javascriptiosiphoneseleniumsaucelabs

Selenium testing on iPhone with SauceLabs in Javascript


How to do end-to-end testing for iPhones, using Selenium and SauceLabs, for a Javascript application? I am using wd.js as a Selenium client library.

Be browser the result of require("wd").remote(..., "promiseChain"):

browser.init({ 
  browserName: "iphone", 
  version: "4", 
  platform: "OS X 10.6", 
  deviceName: "iPhone", 
  "device-orientation": "portrait"
})
  .sessionCapabilities()
  .then(console.log.bind(console), console.log.bind(console))
  .quit()

This results in:

{ [Error: [init({"browserName":"iphone","version":"4","platform":"OS X 10.6","deviceName":"iPhone","device-orientation":"portrait","record-video":false,"record-screenshots":false})] The environment you requested was unavailable.] data: 'Invalid device name specified: iPhone' }

However the combination is taken directly from https://saucelabs.com/platforms

Everything works fine for all other combinations, including Android ones.


Solution

  • The deviceName property needs to be removed, then it works.