Closed AzySir closed 4 years ago
Events ftw (eye roll) - Fixed issue with below code
Also important to note that page.on should not have an "await" before page.on (note the issue vs the solution)
var myobj = 0;
const log_result = (value) => {
console.log(value)
}
page.on('response', async response => {
const response_json = await response.json();
myobj = { unit_price: response_json.unit_price, carton_price: response_json.carton_price };
log_result(myobj)
});
Steps to reproduce
Tell us about your environment:
What steps will reproduce the problem?
Running the automation script will through the error. The "return obj" is not being returned to the parent obj. The object being returned is the response object...
Please include code that reproduces the issue.
What is the expected result? Expecting result should be -
What happens instead?