lundi 6 juillet 2015

Nightwatch.js cannot set a string variable to an input field?

I am testing some JavaScript code with Nightwatch.js. I want to read a value from an input tag, increase or decrease it by 1 and then write it back to the input tag. Therefore I wrote this code:

.getValue('#inputConfigReading', function(result){
    val = parseInt(result.value);
    if (val % 2 == 0)
        val++;
    else
        val--;
    val = val+'';
})
.clearValue('#inputConfigReading')
.setValue('#inputConfigReading', val)

I checked it out. The variable val has the correct value after the command val = val+'';. But anyway when I run the code Nightwatch is writing undefined into the input field. Why?

Aucun commentaire:

Enregistrer un commentaire