Patrick Canfield
Patrick Canfield

Reputation: 1655

Why is Protractor complaining about target browser config when I'm not targeting a browser?

I'm writing an app using Ionic/Angular and testing it with Protractor. I'd like to test it using Sauselabs Appium so I can test the app running natively on the various target platforms. I'm launching Protractor with:

SAUCE_USERNAME=$(SAUCE_USERNAME) SAUCE_ACCESS_KEY=$(SAUCE_ACCESS_KEY) ./node_modules/.bin/protractor protractorConfig.js

But I get this error message:

[launcher] Running 1 instances of WebDriver
[launcher] Error: TypeError: Target browser must be a string, but is <object>; did you forget to call forBrowser()?

My protractorConfig.js looks like:

/* global exports */
/* global process */
exports.config = {
  sauceUser: process.env.SAUCE_USERNAME,
  sauceKey: process.env.SAUCE_ACCESS_KEY,
  capabilities: {
    appiumVersion: "1.0",
    app: "sauce-storage:app.zip",
    platformName: "iOS",
    platformVersion: "7.1",
    deviceName: "iPhone Simulator"
  },
  allScriptsTimeout: 30000,
  specs: [
    "spec/feature/*.js"
  ]
};

Upvotes: 1

Views: 1878

Answers (2)

ji-ruh
ji-ruh

Reputation: 701

Try adding of 'browserName': 'chrome' into your capabilities.

Upvotes: 0

Patrick Canfield
Patrick Canfield

Reputation: 1655

I should have read the docs more carefully. Appium's documentation for Desired Capabilities says that 'browserName' should be an empty string if you're not targeting a browser.

Updating my protractorConfig accordingly fixes the issue.

/* global exports */
/* global process */
exports.config = {
  sauceUser: process.env.SAUCE_USERNAME,
  sauceKey: process.env.SAUCE_ACCESS_KEY,
  capabilities: {
    appiumVersion: "1.0",
    app: "sauce-storage:app.zip",
    platformName: "iOS",
    platformVersion: "7.1",
    deviceName: "iPhone Simulator",
    browserName: ""
  },
  allScriptsTimeout: 30000,
  specs: [
    "spec/feature/*.js"
  ]
};

Upvotes: 2

Related Questions