protractor-cucumber icon indicating copy to clipboard operation
protractor-cucumber copied to clipboard

Warning: Target browser must be a string, but is <object>;

Open lsiden opened this issue 9 years ago • 2 comments

I get this after I installed grunt-cucumber-js and ran "grunt cucumberjs". I tried to run it from the command-line like so and got more info:

$ node_modules/grunt-cucumber/node_modules/cucumber/bin/cucumber.js

Feature: Homepage
  As a user
  I want to visit the homepage
  So that I can access the various features on offer

/home/lsiden/pah/cpportal/node_modules/protractor-cucumber/node_modules/selenium-webdriver/builder.js:408
       'Target browser must be a string, but is <' + (typeof browser) + '>;' +
                                                                             ^
TypeError: Target browser must be a string, but is <object>; did you forget to call forBrowser()?
  at TypeError (native)
  at [object Object].Builder.build (/home/lsiden/pah/cpportal/node_modules/protractor-cucumber/node_modules/selenium-webdriver/builder.js:408:79)
  at new World (/home/lsiden/pah/cpportal/node_modules/protractor-cucumber/lib/index.js:17:6)
  at Object.<anonymous> (/home/lsiden/pah/cpportal/node_modules/grunt-cucumber/node_modules/cucumber/bin/cucumber.js:4:5)
  at Module._compile (module.js:460:26)
  at Object.Module._extensions..js (module.js:478:10)
  at Module.load (module.js:355:32)
  at Function.Module._load (module.js:310:12)
  at Function.Module.runMain (module.js:501:10)
  at startup (node.js:129:16)
  at node.js:814:3

My step_definitions/steps.js file was taken directly from the example: var pc = require('protractor-cucumber');

var steps = function() {
  var seleniumAddress = 'http://localhost:4444/wd/hub';
  var options = { browser : 'chrome', timeout : 100000 };
  this.World = pc.world(seleniumAddress, options);

  this.After(function(callback) {
    this.quit(callback);
  });
};

module.exports = steps;

Is there something else you need to update in the README.md?

lsiden avatar Aug 31 '15 20:08 lsiden

I'm having the same issue. Please let me know if you have any suggestions / resolutions. i ran it with $ cucumber.js homepage.feature in the feature folder

works if you use the PR referenced in: https://github.com/AndrewKeig/protractor-cucumber/pull/21

stil... i'm getting:

 Then I should see a "navbar"       # homepage.feature:8
      TypeError: Invalid locator
        at Function.webdriver.Locator.checkLocator (
...

JohannesFerner avatar Sep 12 '15 15:09 JohannesFerner

Hi,

This appears to be the same problem I solved here:

https://github.com/AndrewKeig/protractor-cucumber/issues/22

Kevin

philokev avatar Sep 12 '15 22:09 philokev