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

[Feature] Add context "platform" option #6070

Closed
zdm opened this issue Apr 4, 2021 · 7 comments
Closed

[Feature] Add context "platform" option #6070

zdm opened this issue Apr 4, 2021 · 7 comments

Comments

@zdm
Copy link

zdm commented Apr 4, 2021

Hi.

Chrome Emulation.setUserAgentOverride devtools call supports platform option.
Is it possible to add this option to the new context constructor options, in order to have this setting applied automatically to all pages, opened by thus context?

@pavelfeldman
Copy link
Member

Could you share more about your use case?

@zdm
Copy link
Author

zdm commented Apr 4, 2021

To override userAgent for chromium playwright uses Emulation.setUserAgentOverride call.
https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setUserAgentOverride

This call supports additional platform option, that allows to override navigation.platform. In our case we need to override platform together with the user Agent to keep them consistent.

So, I am propose to add new platform option to context constructor:

const ctx = await browser.newContext({
    userAgent: "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1",
    platform: "iPad",
});

@pavelfeldman
Copy link
Member

pavelfeldman commented Apr 4, 2021

I understand that, I was curious about your use case that requires it. What is your setup?

@zdm
Copy link
Author

zdm commented Apr 4, 2021 via email

@zdm
Copy link
Author

zdm commented Apr 4, 2021

Also, could you, pls, take a look at issue #6026 again?
I found the way to reproduce it.
For me it appears every time, when I run script.
Is it possible to update exports to the new rules? I tested new syntax and it works in lts and latest releases.
Thank you.

@pavelfeldman
Copy link
Member

We don't prioritize features for scrapers and spammers - if property decided to detect bots, we respect their choice. At the same time, you can use https://playwright.dev/docs/api/class-chromiumbrowsercontext#chromiumbrowsercontextnewcdpsessionpage to issue arbitrary cdp commands should you choose to.

@ccll
Copy link

ccll commented Jul 11, 2024

We don't prioritize features for scrapers and spammers - if property decided to detect bots, we respect their choice

Respect to you for the choice, it's very reasonable.

But the situation may have changed in the last 2 years, we are in the cyber-security business that offer software to check if an URL links to phishing websites, using automated browsers of cause, nowadays we are seeing more and more phishing sites are using bot detection to evade security checks, so beside the traditional benign sites vs. scrapers game, now we have this new kind of malicious sites vs. security guard game.

Maybe time to re-consider the choices?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants