Puppeteer: getting the returned value with Evaluate

Created on 24 Aug 2017  路  1Comment  路  Source: puppeteer/puppeteer

Hi guys .
as a previous Chromy user , i had the option to evaluate a function in the window context (p.s the current opened page instance) then chaining the result from the window context into the chromy context in order to get the value and pass it along.
chromy.goto(url).wait(predicate).evaluate(()=>{window.SomeFunction()}.results((someFunctionReturnedValue)=>{console.log(someFunctionReturnedValue)}
is there any chance you guys know which function in Puppeteer is the equivalent "results" function?
thanks in advance!

Most helpful comment

The return value of page.evaluate is just that.

const someFunctionReturnedValue = await page.evaluate(() => {
   return window.SomeFunction(); 
});
console.log(someFunctionReturnedValue);

or succinct:

console.log(await page.evaluate(() =>  window.SomeFunction()));

>All comments

The return value of page.evaluate is just that.

const someFunctionReturnedValue = await page.evaluate(() => {
   return window.SomeFunction(); 
});
console.log(someFunctionReturnedValue);

or succinct:

console.log(await page.evaluate(() =>  window.SomeFunction()));
Was this page helpful?
0 / 5 - 0 ratings

Related issues

namma-geniee picture namma-geniee  路  3Comments

sheweichun picture sheweichun  路  3Comments

kesava picture kesava  路  3Comments

historylife picture historylife  路  3Comments

barnash picture barnash  路  3Comments