Tuesday, April 12, 2016

Chain operations after several elements have been retrieved

Leave a Comment

For testing we have to fill a complex page using intern/leadfoot. Each part of the page is taken care off by a separate function which receives the necessary elements and input data.

Now we have the problem, that actions on these elements in the subfunctions can not be chained anymore, since they are elements and not commands.

Is it somehow possible to again chain the operations? I tried a lot with creating a new command using setContext() or with custom commands but did not succeed so far.

let inputs; return this.remote   .get('some/url')   .findAllByTagName('input') // Finds two input elements   .then(inputElements=> inputs = inputElements)   .then(()=> Promise.all([       inputs[0].clearValue(), // I would like to be able to write: inputs[0].clearValue().type('a')       inputs[1].clearValue(),   ]))   .then(()=> Promise.all([       inputs[0].type('a'),       inputs[1].type('b'),   ])) 

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment