Monday, 17 April 2017

NightwatchJS > Storing response from "elements" command and performing further actions

I have a button with the same class name that appears on the page in a few instances. How do I store the response from elements(i.e Web Element JSON Objects) in array to perform further actions on them as clicking and asserting? I've been trying to do the following but it did not work:

 browser.elements('css selector', 'elem', function(res) {
        arr = res.value;
        console.log(arr);
        a = arr[1].ELEMENT;
        console.log(a);
        browser.elementIdClick(a);

It prints the index of the ELEMENT, but the elementIdClick command does not perform any actions nor throws any errors in response. Please help



via andddrey

No comments:

Post a Comment