Puppeteer: How to submit a form?

前端 未结 2 1205
离开以前
离开以前 2020-12-28 12:24

Using puppeteer, how could you programmatically submit a form? So far I\'ve been able to do this using page.click(\'.input[type=\"submit\"]\') if the form actua

2条回答
  •  温柔的废话
    2020-12-28 12:52

    Try this

    const form = await page.$('form-selector');
    await form.evaluate(form => form.submit());
    

    For v0.11.0 and laters:

    await page.$eval('form-selector', form => form.submit());
    

提交回复
热议问题