timecut icon indicating copy to clipboard operation
timecut copied to clipboard

page.evaluateHandle method missed in puppeteer

Open vasanthudhaya opened this issue 6 years ago • 3 comments

Hi @tungs, thanks for the timecut repo. I checked the time-snap index.js. you wrote all the functions are on promise type. On that the page.evaluateHandle puppeter method is not present. Kindly let me know how to include or implement the evaluatehandle method in timecut.

cc: @varunarora

vasanthudhaya avatar Nov 08 '19 06:11 vasanthudhaya

Hi @vasanthudhaya -- I'm not exactly sure what you're trying to do and how you're trying to do it. If you're talking about using the undocumented (and unsupported) config.preparePage, timesnap should be passing page as an argument.

So in your code would look something like this:

timecut({
   //...
   preparePage: function (page) {
      return page.evaluateHandle(function () {
         return document.getElementById('element');
      }).then(function (handle) {
         // code with handle here
      });
   }
   //...
});

tungs avatar Nov 11 '19 20:11 tungs

Thanks @tungs. But i need one more is to enable a button and need to click the button before page screenshot. I tried with prepagepage function, even-though the screenshot is capturing very fast. From my scenario i need to click the button once the page loaded success after that i wanna to capture the screen. Kindly let me know what to do for this.

cc: @varunarora

vasanthudhaya avatar Nov 12 '19 06:11 vasanthudhaya

Hi, A little late to the party.. I'm interested in achieving something similar to what @vasanthudhaya said, eg.: clicking a button after page loaded or wait for some element to load, and before making screenshots. Any updates on this, please, @tungs ?

Thank you!

florinvirdol avatar Aug 31 '22 22:08 florinvirdol