Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Patchright with user-agent fails to pass Input.cordinatesLeak Brotector #32

Open
1 task done
regseb opened this issue Jan 4, 2025 · 1 comment
Open
1 task done
Labels
CDP-Patches Related to CDP-Patches detection related to bot detection

Comments

@regseb
Copy link

regseb commented Jan 4, 2025

System info

  • Playwright Version: 1.49.2
  • Operating System: Ubuntu 24.04.1 LTS
  • Browser: Chromium
  • Other info: Node v22.12.0

Source code

  • I provided exact source code that allows reproducing the issue locally.

Test file (self-contained)

  • package.json

    {
      "name": "testcase",
      "version": "1.0.0",
      "type": "module",
      "dependencies": {
        "patchright": "1.49.2"
      }
    }
  • index.js

    import { chromium } from "patchright";
    
    const test = async (path, args) => {
        const browser = await chromium.launch({
            channel: "chromium",
            viewport: null,
            args,
        });
        const context = await browser.newContext();
        const page = await context.newPage();
        await page.goto("https://kaliiiiiiiiii.github.io/brotector/");
        await page.locator("#clickHere").click();
        await page.screenshot({ path, fullPage: true });
        await context.close();
        await browser.close();
    };
    
    await test("with-user-agent.png", [
        "--user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36" +
        " (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
    ]);
    await test("without-user-agent.png", []);

Steps

  • npm install
  • node index.js

Expected

The script should pass Input.cordinatesLeak Brotector with or without the user-agent.

Actual

The script with the user-agent does not pass Input.cordinatesLeak Brotector.

With user-agent Without user-agent
with-user-agent without-user-agent
@kaliiiiiiiiii
Copy link
Collaborator

kaliiiiiiiiii commented Jan 4, 2025

"--user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36" +
    " (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"

The script with the user-agent does not pass Input.cordinatesLeak Brotector.

Overwriding the useragent is detectable and discouraged. The Input.cordinatesLeak does not have any direct correlation with this afaik.

Might be that overriding the UA changes the window size too. What you can try is setting it to Maximized.

This issue will be resolved (only for Python yet) together with Kaliiiiiiiiii-Vinyzu/CDP-Patches#15

@kaliiiiiiiiii kaliiiiiiiiii added detection related to bot detection CDP-Patches Related to CDP-Patches labels Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CDP-Patches Related to CDP-Patches detection related to bot detection
Projects
None yet
Development

No branches or pull requests

2 participants