Skip to content

[Question] Is it possible to define host resolution rules per browser instance? #2767

Closed

Description

In my daily work, I often have to tweak the /etc/hosts file for routing production site URLs to the development sites for testing.
Is it possible to launch a browser instance with a set of customized host resolution rules? For example,

const browser = await chromium.launch( {
    hosts: {
        'example.com': '127.0.0.1',  // all the request to example.com will then be routed to my local machine.
    }
} );

I believe it's possible by dockerizing my playwright testing program, but would like to see if there is a lightweight solution for this.

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions