Back to Crawlee

Fill and Submit a Form using Puppeteer

docs/examples/forms.mdx

3.16.01.0 KB
Original Source

import RunnableCodeBlock from '@site/src/components/RunnableCodeBlock'; import ApiLink from '@site/src/components/ApiLink'; import CrawlSource from '!!raw-loader!roa-loader!./forms.ts';

This example demonstrates how to use <ApiLink to="puppeteer-crawler/class/PuppeteerCrawler">PuppeteerCrawler</ApiLink> to automatically fill and submit a search form to look up repositories on GitHub using headless Chrome / Puppeteer. The crawler first fills in the search term, repository owner, start date and language of the repository, then submits the form and prints out the results. Finally, the results are saved either on the Apify platform to the default <ApiLink to="core/class/Dataset">dataset</ApiLink> or on the local machine as JSON files in ./storage/datasets/default.

:::tip

To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.

:::

<RunnableCodeBlock className="language-js" type="puppeteer"> {CrawlSource} </RunnableCodeBlock>