3

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.

ehmicky
  • 1,915
  • 4
  • 20
  • 29

1 Answers1

2

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

ehmicky
  • 1,915
  • 4
  • 20
  • 29
  • 1
    Thanks! Had the same problem but with codeception. Removing the deviceName property from the configuration solved it. Because of poor json decoding error handling in remote webdriver, the error shown was `[PHPUnit_Framework_Exception] Argument #2 (No Value) of PHPUnit_Framework_Assert::assertNotContains() must be a array, traversable or string` instead of `Invalid device name specified: iPhone`. Adding this here so that it may help others that use remote webdriver against saucelabs. – Motin Jul 03 '14 at 06:23