javascript - How to pass variable value from one function to another in Nightwatch js -
i using nightwatch.js test automation framework.
in code value, not being able pass recorded value function. here code:
createlife: function (browser) { browser.getvalue('#lifeid', function (r) { = r.value; browser.execute(function () { lifetemplatesmanager.loadaddonlineitem(a); //doesn't work/the value of 'a' not being passed. }); console.log("id of newly created life", a); } }
whenever new life gets created, gets assigned new id. able id , store in 'a' , display in console. question how can pass value of 'a' function 'lifetemplatesmanager.loadaddonlineitem'
help appreciated. beginner @ js.
thanks.
browser.execute used inject snippet of javascript page (inside browser environment) execution, , variable a not accessible in environment.
in order make use of a inside browser environment, can following:-
browser.execute(function (a) { lifetemplatesmanager.loadaddonlineitem(a); },[a]);
please refer this link nightwatch documentation.
Comments
Post a Comment