mardi 11 septembre 2018

Nightwatch typing keys not working in firefox

Situation:

I've created a test in Nightwatch and am running it in chrome and firefox.

My test is supposed to click on an input element and type something.

The Problem: In chrome everything works fine, however, in firefox it does not. I can click on the element but then firefox fails with typing.

I'm not using the .keys function of Nightwatch directly because I've written a custom function around it.

Code:

Here you can see my function to type something:

typeKeys: function(str) {
    if ('' === str || 'undefined' === typeof str) {
        console.log('Error: Nwxp.actions.typeKeys(str) - str is undefined or empty!');
        return this;
    }

    for (var index = 0; index < str.length; index++) {
        this.parent.browser.keys(str[index]).pause(5);
    }

    return this;
}

I'll also add my settings for firefox. Maybe it messed something up there.

'firefox' : {
    'desiredCapabilities': {
        'browserName'      : 'firefox',
        'javascriptEnabled': true,
        'acceptSslCerts'   : true,
        'nativeEvents'     : true,
        'firefoxOptions'   : {
            'args': [
                // '-headless',
                // 'no-sandbox'
            ]
        }
    }
}

Aucun commentaire:

Enregistrer un commentaire