GithubHelp home page GithubHelp logo

Comments (11)

ysmood avatar ysmood commented on May 10, 2024 1

Because PageAddScriptToEvaluateOnNewDocument is under the Page domain, so by its name it obviously should work only for a page instance πŸ˜‚.

From its doc, you can find out that it's designed for navigation and iframes, not a hook for every new page.

Injecting a script to every page should follow the hook design pattern. So what you should do is listening to page creation events and run a script for each page.

I think I won't add an AddScriptOnEachDoc helper for you. But I'll an event helper to help you easily hook whatever you want.

from rod.

ysmood avatar ysmood commented on May 10, 2024 1

v0.31.0 added some helpers to help you do this. Here's the example:

https://github.com/ysmood/rod/blob/9b680d3afeb2bec4007ccea53ea2b1d70f602976/examples_test.go#L204-L226

from rod.

ysmood avatar ysmood commented on May 10, 2024 1

@zjlx v0.31.1 add browser.EachEvent helper to make it even easier:

https://github.com/ysmood/rod/blob/f04616495a3a1d755e88b2e335f8063327f75581/examples_test.go#L219-L225

from rod.

zjlx avatar zjlx commented on May 10, 2024 1

@khaitranvan96kt Can you raise an issue about https://fingerprintjs.com? It's not bot detection, fingerprinting is another topic.

Yes I know, so I asked @zjlx

Against browser fingerprints, the above JS plug-in is only a fixed value, and it can't achieve random parameters. If you want more configuration, you need to implement it by yourself, learn about JS related knowledge such as webgl and canvas, and set different parameters to meet the requirements of simulating different browser fingerprints.

from rod.

zjlx avatar zjlx commented on May 10, 2024

OK , Thanks a lot.

from rod.

khaitranvan96kt avatar khaitranvan96kt commented on May 10, 2024

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
I used this code for fake browser fingerprint ,

proto.PageEnable{}.Call(page)

proto.PageAddScriptToEvaluateOnNewDocument{
	Source: fingerprint,
}.Call(page)

the js code from https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth
I don't known why need proto.PageEnable ,but if I don't write it the proto.PageAddScriptToEvaluateOnNewDocument not works.
proto.PageAddScriptToEvaluateOnNewDocument only works on current page/tab not working on a link click new pages/tabs.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Can you add a function to add JS script for all browser's pages/tabs something like hook browser's page or some network.
Thanks.

Can you give me the Script to fake the fingerprint?

from rod.

ysmood avatar ysmood commented on May 10, 2024

@khaitranvan96kt You might want to use stealth lib to bypass the bot detection.

from rod.

khaitranvan96kt avatar khaitranvan96kt commented on May 10, 2024
func TestRequestFingerprint2(t *testing.T) {
	for i := 0; i < 3; i++ {
		browser := rod.New().Connect()
		page := bypass.Page(browser)
		page.Navigate("https://fingerprintjs.com/demo").WaitLoad()
		time.Sleep(10 * time.Second)
		filename := fmt.Sprintf("browser_%d.png", i)
		page.ScreenshotFullPage(filename)
		browser.Close()
	}
	fmt.Println("All done, check the screenshot. ✨")
}

It does not work, it is still detected. I wanted to create 3 different browsers, but it was still discovered to be the same.

from rod.

ysmood avatar ysmood commented on May 10, 2024

@khaitranvan96kt Can you raise an issue about https://fingerprintjs.com? It's not bot detection, fingerprinting is another topic.

from rod.

khaitranvan96kt avatar khaitranvan96kt commented on May 10, 2024

@khaitranvan96kt Can you raise an issue about https://fingerprintjs.com? It's not bot detection, fingerprinting is another topic.

Yes I know, so I asked @zjlx

from rod.

khaitranvan96kt avatar khaitranvan96kt commented on May 10, 2024

@khaitranvan96kt Can you raise an issue about https://fingerprintjs.com? It's not bot detection, fingerprinting is another topic.

Yes I know, so I asked @zjlx

Against browser fingerprints, the above JS plug-in is only a fixed value, and it can't achieve random parameters. If you want more configuration, you need to implement it by yourself, learn about JS related knowledge such as webgl and canvas, and set different parameters to meet the requirements of simulating different browser fingerprints.

wow, thank you so much for suggesting me

from rod.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.