Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lsiden opened this issue Aug 31, 2015 · 2 comments
Open

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

lsiden opened this issue Aug 31, 2015 · 2 comments

Comments

@lsiden
Copy link

lsiden commented Aug 31, 2015

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?

@JohannesFerner
Copy link

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:
#21

stil... i'm getting:

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

@philokev
Copy link
Contributor

Hi,

This appears to be the same problem I solved here:

#22

Kevin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants