Skip to content

Conversation

NikkiAung
Copy link

This PR introduces a new login() context helper for both PlaywrightCrawler and PuppeteerCrawler that automatically handles website login forms. The helper supports both single-step login flows (where username and password fields are visible together) and two-step flows (where users must click "Next" after entering username). It includes smart field detection with customizable locators, robust success detection, and optional captcha handling with timeout protection.

Key features: Automatic form detection, custom locators, captcha integration, comprehensive error handling, and extensive test coverage (52 total tests across both crawlers). The helper gracefully handles cases where no login form is found and provides clear error messages for debugging.

async requestHandler({ login }) {
    await login({
        username: '[email protected]',
        password: 'password123',
        handleCaptcha: async (page) => {
            // Solve captcha here
        },
    });
}

Resolves full features for Puppeteer #3040

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant