2

I run puppeteer in a lambda, which works fine using https://www.npmjs.com/package/puppeteer-lambda

In my case a user input is needed in between, so I need to stop somehow and wait for user input.

Puppeteer lambda is always headless, so this won't help I guess How can I pause and wait for user input with Puppeteer?

I tested to have page and browser as global variables and having 2 step functions, but without success.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Tobi
  • 1,702
  • 2
  • 23
  • 42
  • Do you need to wait for input inside the page or do you need to wait until some other event inside your code happens? – Thomas Dondorf Jun 14 '19 at 15:57
  • In need to wait for input inside the page – Tobi Jun 15 '19 at 05:21
  • Then you should be fine with `waitForFunction`. What do you want to wait for? – Thomas Dondorf Jun 15 '19 at 10:38
  • @ThomasDondorf His problem is that he is using Puppeteer in serverless, and it is therefore always headless. See his commaent on the linked SO question. My problem with the question, is why do you expect manual user input through a browser if you are running Pupeteer as such? Can you clarify more your use case? – Anas Tiour Jun 15 '19 at 11:25
  • @AnasTiour I understand, but `waitForFunction` also works for the headless browser. With "input inside the page" I guess he means "wait until some event inside the page happens" as there is no user/UI of the browser (as it's headless). – Thomas Dondorf Jun 15 '19 at 12:01
  • 1
    The usecase is a login which in some cases wants sms verification. the input would be the sms code. – Tobi Jun 15 '19 at 16:55
  • @Tobi, did you find an answer to this issue? I was thinking about having node await a promise that resolves on twillio api,then pass that info into puppeteer. – async await Nov 20 '21 at 06:31

0 Answers0