Stefanie Uhl
Stefanie Uhl

Reputation: 324

Target browser must be a string... (selenium, protractor)

i have upgraded my environment to have support for my tests for firefox, chrome, etc.

I have installed:

Node LTS (6.10.0)
Selenium Server Standalone 3.1.0
[email protected]
[email protected]

When i now want to run my test i receive:

    [17:31:32] I/launcher - Running 1 instances of WebDriver
    [17:31:32] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
    [17:31:32] E/launcher - Error: TypeError: Target browser must be a string, but is <undefined>; did you forget to call forBrowser()?
    [...]
    [17:31:32] E/launcher - Process exited with error code 100

    Process finished with exit code 100

What does that mean?

The config.js is:

var TIMEOUT = 10000;
exports.config = {
    ...
    capabilities: [
        {
            'browserName': 'firefox', //tried as 'firefox', firefox and "firefox"
            //'marionette': true //tried true and false
        },
    ],
    ...
};

Upvotes: 1

Views: 7335

Answers (1)

AdityaReddy
AdityaReddy

Reputation: 3645

That was tricky and funny :) You know what .. There is no issue with browserName. Problem was you are providing the capabilities object incorrectly. You are providing an array whereas you need to send 1 capabilities object

Remove '['  & ']'

capabilities: [{'browserName': 'firefox'},] - This is incorrect . This means an Array of size 1 with index 0 holding your firefox config

It should be this - capabilities: {'browserName': 'firefox'}

Upvotes: 2

Related Questions