Skip to content

async function not awaited in main world execution mode #395

@barjin

Description

@barjin

When evaluating an asynchronous function in the main world execution mode, the return value is always { }.

Example:

from camoufox.sync_api import Camoufox

with Camoufox(
    main_world_eval=True
) as camoufox:
    page = camoufox.new_page()
    result = page.evaluate("""mw:async () => ({"test": "value"})""")
    print(result)

Prints

{ }

After removing the mw: label, the script prints {'test': 'value'} as expected. Making the function sync (removing the async keyword while keeping mw:) will also run the function and print {'test': 'value'}.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions