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

Bypass headless chrome detection #94

Closed
Leezj9671 opened this issue Jul 6, 2020 · 6 comments
Closed

Bypass headless chrome detection #94

Leezj9671 opened this issue Jul 6, 2020 · 6 comments
Assignees
Labels
doc Improvements or additions to documentation

Comments

@Leezj9671
Copy link

Any code examples? Make it as a built-in function would be great!

Detection page: https://intoli.com/blog/not-possible-to-block-chrome-headless/chrome-headless-test.html

@Leezj9671 Leezj9671 added the enhance New feature or request label Jul 6, 2020
@ysmood
Copy link
Collaborator

ysmood commented Jul 6, 2020

Useful link: https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-addScriptToEvaluateOnNewDocument

You can use this example to hook every newly opened page, such as resolving this comment:

rod/examples_test.go

Lines 282 to 295 in acfcf72

go browser.EachEvent(func(e *proto.TargetTargetCreated) {
// We only want to listen to events which are when a Page is created.
// This filters out all other target types are created, e.g service
// workers, shared workers, and background pages.
if e.TargetInfo.Type != proto.TargetTargetInfoTypePage {
return
}
// We use the ID to obtain the page ourselves to use.
page02 := browser.PageFromTargetID(e.TargetInfo.TargetID)
// Log "hey" on each newly created page.
page02.Eval(`() => console.log("hey")`)
})()

@ysmood ysmood added doc Improvements or additions to documentation and removed enhance New feature or request labels Jul 6, 2020
@ysmood
Copy link
Collaborator

ysmood commented Jul 6, 2020

@NormalPunch you are better than me on this, please help to doc.

@ysmood
Copy link
Collaborator

ysmood commented Jul 6, 2020

This is the example, we will close this ticket. If you still have problems, please let us know.

https://go-rod.github.io/#/emulation?id=prevent-bot-detection

@ysmood ysmood closed this as completed Jul 6, 2020
@0xhiroki

This comment has been minimized.

@ysmood

This comment has been minimized.

@0xhiroki

This comment has been minimized.

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

No branches or pull requests

4 participants