schickling / chromeless

🖥 Chrome automation made simple. Runs locally or headless on AWS Lambda.
https://chromeless.netlify.com
MIT License
13.25k stars 575 forks source link

Cannot run wait selector after using `.evaluate()` #435

Open IAMtheIAM opened 6 years ago

IAMtheIAM commented 6 years ago

I confirm an issue with waiting for elements occurs after running .evaluate, The wait fails after

    const screenshot = await chromeless
        .setViewport({width: 1920, height: 1080, scale: 1})
         .goto('https://www.mylogin.com')
         .evaluate(() => {            doSomething(); })    <---- comment this out and it works
        .click('a.signin')
        .wait(2000)
        .type('username', 'input[name="username"]')
        .type('password', 'input[name="password"]')
        .press(13)
        .screenshot();

Results in

Error: wait("input[name="username"]") timed out after 10000ms

With the evaluate line removed, the screenshot and whole express works fine.