Skip to content

Problem with Dialog #397

@luka-dev

Description

@luka-dev

Hi, when i maked a test scenarion based on Headless Detector, i faced problem with Dialog.
I when i try dismiss dialog, script freezing and crash into a timeout in while.

Error Message
UnhandledRejection (Client) { context: {}, sessionId: null, sessionName: undefined } TimeoutError: undefined

Script

import {Handler} from 'secret-agent';

function randomInt(min: number, max: number) {
    return Math.random() * (max - min) + min;
}

(async () => {
    const handler = new Handler();

    const agent = await handler.createAgent();

    agent.activeTab.on('dialog', async (dialog) => {
        dialog.dismiss(true);
        console.log('dialog');
    });

    await agent.goto('https://infosimples.github.io/detect-headless/');

    console.log('goto');

    await agent.interact({
        move: [randomInt(1, 1000), randomInt(1, 1000)]
    }, {
        move: [randomInt(1, 1000), randomInt(1, 1000)]
    });

    console.log('interact');

    console.log(await agent.document.title);

    await handler.close();
})();

In a test run, i see in log goto, dialog and after mentioned error, without interact and title output.
Am i wrong in my actions? Or it's a problem on SecretAgent side?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions