question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Target.createBrowserContext with proxyServer parameter not working.

See original GitHub issue

I was trying to test Target.createBrowserContext to see what it does, and can’t seem to find a way to make the proxyServer parameter work. The same proxy works if I set it when launching chrome with the --proxy-server= flag. I tried setting the proxy with and without scheme:// but the ip shown in the website visited with Target.createTarget is always my real ip, not the proxy.

To test it, I am launching chrome with --remote-debugging-port=9222 and then running this nodejs script:

const CDP = require('chrome-remote-interface');

async function start() {
    // get browser target
    const {webSocketDebuggerUrl} = await CDP.Version();
    const browser = await CDP({
        target: webSocketDebuggerUrl
    });
    const {Target} = browser;
    // create new context with proxy
    const {browserContextId} = await Target.createBrowserContext({
        proxyServer: '127.0.0.1:12345'
    });
    // create new target
    const {targetId} = await Target.createTarget({
        url: 'https://icanhazip.com',
        browserContextId
    });
}

start();

Am I using it wrong?

Component Version
Operating system Windows 10
Node.js 14.17.5
Chrome/Chromium/… Chrome 99.0.4844.82 (Official Build) (64-bit)
chrome-remote-interface 0.31.1

Is Chrome running in a container? NO

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cyrus-andcommented, Mar 24, 2022

And I’m afraid I cannot do anything about it either. Closing this, feel free to add more information if you come up with something.

1reaction
wxkkcommented, Mar 24, 2022

(Yes the :: was just an error in the message.)

I just tested in linux and it works there. Will try to test on a different windows box and see what happens.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Target domain - Chrome DevTools Protocol - GitHub Pages
Retrieves a list of available targets. parameters. filter: TargetFilter. Only targets matching filter will be reported. If filter is not specified and target...
Read more >
target - Go Packages
Package target provides the Chrome DevTools Protocol commands, types, and events for the Target domain.
Read more >
Target.createBrowserContext doesn't have a clean browser state
I believe this only works in headless Chrome. Do you get "Not supported" error in response to createBrowserContext?
Read more >
try - Mercurial - Mozilla
executablePath returns executablePath for channel (launcher.spec.ts)": [ + "PASS" + ], "Launcher specs Browser target events should work ...
Read more >
third_party/blink/public/devtools_protocol/browser_protocol.pdl
Runs the contrast check for the target page. Found issues are reported. # using Audits.issueAdded event. command checkContrast. parameters.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found