Nightwatch: Geckodriver Selenium 3.5.3 launches chrome instead of firefox

Created on 5 Sep 2017  路  6Comments  路  Source: nightwatchjs/nightwatch

System Properties
OS : Windows 7
Selenium Server :3.5.3
Node Version : v6.10.3

Nightwatch Command :-

nightwatch --config nightwatch.windows.js -e firefox --reporter ./html-reporter.js

conf JS

module.exports = {
    src_folders: ["specs/main", "specs/GridServices"],
    output_folder: "reports",
    page_objects_path: "pages/",
    globals_path: "globals.js",
    test_workers: false,
    asyncHookTimeout: 10000,
    selenium: {
        start_process: true,
        server_path: "node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-3.5.3.jar",
        log_path: "./reports",
        host: "127.0.0.1",
        port: 4444,
        cli_args: {
            "webdriver.chrome.driver": "./node_modules/chromedriver/lib/chromedriver/chromedriver.exe",
            "webdriver.gecko.driver": "./node_modules/geckodriver/geckodriver.exe",
            "webdriver.ie.driver": "./node_modules/iedriver/lib/iedriver/IEDriverServer.exe"
        }
    },
    test_settings: {
        default: {
            selenium_port: 4444,
            selenium_host: "localhost",
            silent: true,
            skip_testcases_on_fail: false,
            end_session_on_fail: false,
            screenshots: {
                enabled: false,
                on_failure: true,
                path: "./reports"
            },
            globals: {
                site_url: "${SELENIUM_SITE_URL}",
                Environment: "${SELENIUM_ENV}"
            },
            desiredCapabilities: {
                browserName: "chrome",
                javascriptEnabled: true,
                acceptSslCerts: true,
                chromeOptions: {
                    args: ["start-maximized"],
                    prefs: {
                        credentials_enable_service: false,
                        password_manager_enabled: false
                    }
                }
            }
        },
        firefox: {
            desiredCapabilities: {
                browserName: "firefox",
                marionette: true,
            }
        },
        ie: {
            desiredCapabilities: {
                browserName: "internet explorer",
                IE_ENSURE_CLEAN_SESSION : true
            }
        }
    }
};

stale

Most helpful comment

This bug seems to be triggered by the presence of chromeOptions. A work-around is to not add chromeOptions to test_settings.default.desiredCapabilities and only add them to environments that are supposed to use Chrome.

All 6 comments

selenium: {
        start_process: true,
        server_path: 'node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-3.5.3.jar',
        log_path: './reports',
        host: '127.0.0.1',
        port: 4444,
        cli_args: {
            'webdriver.chrome.driver': './node_modules/chromedriver/lib/chromedriver/chromedriver.exe',
            'webdriver.gecko.driver': './node_modules/geckodriver/geckodriver.exe',
            'webdriver.ie.driver': './node_modules/iedriver/lib/iedriver/IEDriverServer.exe',
        },
    },
    test_settings: {
        default: {
            selenium_port: 4444,
            selenium_host: 'localhost',
            silent: true,
            skip_testcases_on_fail: false,
            end_session_on_fail: false,
            screenshots: {
                enabled: false,
                on_failure: true,
                path: './reports',
            },
            firefox: {
                desiredCapabilities: {
                    browserName: 'firefox',
                    marionette: true,
                },
            }

@saibtech That's because you actually do not have an environment named _firefox_. Your config structure is not correct. Cheers.

test_settings: {
        default: {
            selenium_port: 4444,
            selenium_host: 'localhost',
            silent: true,
            skip_testcases_on_fail: false,
            end_session_on_fail: false,
            screenshots: {
                enabled: false,
                on_failure: true,
                path: './reports',
            },
        },
        firefox: {
            desiredCapabilities: {
                browserName: 'firefox',
                marionette: true,
            },
        }

@mug3n
I didn't put my fully config structure . I have editted the same

@saibtech it would be worth changing the default to firefox and see if firefox opens. If nigjtwatch has any issues with your alternative environments it defaults to the default which is chrome. Also entering --env twice will cause the default to run instead of overwriting the first --env.

@promo-gpsw Just tried this out. Setting desiredCapabilities on default test_settings to Chrome will launch Chrome regardless of environment parameter. When we remove it, Firefox will be the default and environment parameters work as expected. I'm guessing this is because any default browser set will be launched regardless and this is probably a bug. Would be nice to receive confirmation on this from someone else.

This bug seems to be triggered by the presence of chromeOptions. A work-around is to not add chromeOptions to test_settings.default.desiredCapabilities and only add them to environments that are supposed to use Chrome.

This issue has been automatically marked as stale because it has not had any recent activity.
If possible, please retry using the latest Nightwatch version and update the issue with any relevant details. If no further activity occurs, it will be closed. Thank you for your contribution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidlinse picture davidlinse  路  4Comments

gary5 picture gary5  路  4Comments

antogyn picture antogyn  路  4Comments

lgaticaq picture lgaticaq  路  3Comments

danielbentov picture danielbentov  路  4Comments