Skip to content

Commit 1b0851d

Browse files
committed
New test added.
1 parent 7e4be30 commit 1b0851d

File tree

3 files changed

+46
-25
lines changed

3 files changed

+46
-25
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "puppeteer-real-browser",
3-
"version": "1.3.10",
3+
"version": "1.3.11",
44
"description": "This package is designed to bypass puppeteer's bot-detecting captchas such as Cloudflare. It acts like a real browser and can be managed with puppeteer.",
55
"main": "lib/cjs/index.js",
66
"module": "lib/esm/index.mjs",

test/cjs/test.js

+22-12
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,28 @@ test('Cloudflare Turnstile', async () => {
8484
})
8585

8686

87+
test('Fingerprint JS Bot Detector', async () => {
88+
const { page, browser } = await connect(realBrowserOption)
89+
await page.goto("https://fingerprint.com/products/bot-detection/");
90+
await new Promise(r => setTimeout(r, 5000));
91+
const detect = await page.evaluate(() => {
92+
return document.querySelector('.HeroSection-module--botSubTitle--2711e').textContent.includes("not") ? true : false
93+
})
94+
await browser.close()
95+
assert.strictEqual(detect, true, "Fingerprint JS Bot Detector test failed!")
96+
})
97+
98+
99+
// If you fail this test, your ip address probably has a high spam score. Please use a mobile or clean ip address.
100+
test('Datadome Bot Detector', async (t) => {
101+
const { page, browser } = await connect(realBrowserOption)
102+
await page.goto("https://antoinevastel.com/bots/datadome");
103+
const check = await page.waitForSelector('nav #navbarCollapse').catch(() => null)
104+
await browser.close()
105+
assert.strictEqual(check ? true : false, true, "Datadome Bot Detector test failed! [This may also be because your ip address has a high spam score. Please try with a clean ip address.]")
106+
})
87107

108+
// If this test fails, please first check if you can access https://antcpt.com/score_detector/
88109
test('Recaptcha V3 Score (hard)', async () => {
89110
const { page, browser } = await connect(realBrowserOption)
90111
await page.goto("https://antcpt.com/score_detector/");
@@ -95,16 +116,5 @@ test('Recaptcha V3 Score (hard)', async () => {
95116
})
96117
await browser.close()
97118
// if (Number(score) >= 0.7) console.log('Recaptcha V3 Score: ' + score);
98-
assert.strictEqual(Number(score) >= 0.7, true, "Recaptcha V3 Score (hard) should be >=0.7. Score Result: " + score)
99-
})
100-
101-
test('Fingerprint JS Bot Detector', async () => {
102-
const { page, browser } = await connect(realBrowserOption)
103-
await page.goto("https://fingerprint.com/products/bot-detection/");
104-
await new Promise(r => setTimeout(r, 5000));
105-
const detect = await page.evaluate(() => {
106-
return document.querySelector('.HeroSection-module--botSubTitle--2711e').textContent.includes("not") ? true : false
107-
})
108-
await browser.close()
109-
assert.strictEqual(detect, true, "Fingerprint JS Bot Detector test failed!")
119+
assert.strictEqual(Number(score) >= 0.7, true, "(please first check if you can access https://antcpt.com/score_detector/.) Recaptcha V3 Score (hard) should be >=0.7. Score Result: " + score)
110120
})

test/esm/test.js

+23-12
Original file line numberDiff line numberDiff line change
@@ -87,26 +87,37 @@ test('Cloudflare Turnstile', async () => {
8787

8888

8989

90-
test('Recaptcha V3 Score (hard)', async () => {
90+
test('Fingerprint JS Bot Detector', async () => {
9191
const { page, browser } = await connect(realBrowserOption)
92-
await page.goto("https://antcpt.com/score_detector/");
93-
await page.realClick("button")
92+
await page.goto("https://fingerprint.com/products/bot-detection/");
9493
await new Promise(r => setTimeout(r, 5000));
95-
const score = await page.evaluate(() => {
96-
return document.querySelector('big').textContent.replace(/[^0-9.]/g, '')
94+
const detect = await page.evaluate(() => {
95+
return document.querySelector('.HeroSection-module--botSubTitle--2711e').textContent.includes("not") ? true : false
9796
})
9897
await browser.close()
99-
// if (Number(score) >= 0.7) console.log('Recaptcha V3 Score: ' + score);
100-
assert.strictEqual(Number(score) >= 0.7, true, "Recaptcha V3 Score (hard) should be >=0.7. Score Result: " + score)
98+
assert.strictEqual(detect, true, "Fingerprint JS Bot Detector test failed!")
10199
})
102100

103-
test('Fingerprint JS Bot Detector', async () => {
101+
102+
// If you fail this test, your ip address probably has a high spam score. Please use a mobile or clean ip address.
103+
test('Datadome Bot Detector', async (t) => {
104104
const { page, browser } = await connect(realBrowserOption)
105-
await page.goto("https://fingerprint.com/products/bot-detection/");
105+
await page.goto("https://antoinevastel.com/bots/datadome");
106+
const check = await page.waitForSelector('nav #navbarCollapse').catch(() => null)
107+
await browser.close()
108+
assert.strictEqual(check ? true : false, true, "Datadome Bot Detector test failed! [This may also be because your ip address has a high spam score. Please try with a clean ip address.]")
109+
})
110+
111+
// If this test fails, please first check if you can access https://antcpt.com/score_detector/
112+
test('Recaptcha V3 Score (hard)', async () => {
113+
const { page, browser } = await connect(realBrowserOption)
114+
await page.goto("https://antcpt.com/score_detector/");
115+
await page.realClick("button")
106116
await new Promise(r => setTimeout(r, 5000));
107-
const detect = await page.evaluate(() => {
108-
return document.querySelector('.HeroSection-module--botSubTitle--2711e').textContent.includes("not") ? true : false
117+
const score = await page.evaluate(() => {
118+
return document.querySelector('big').textContent.replace(/[^0-9.]/g, '')
109119
})
110120
await browser.close()
111-
assert.strictEqual(detect, true, "Fingerprint JS Bot Detector test failed!")
121+
// if (Number(score) >= 0.7) console.log('Recaptcha V3 Score: ' + score);
122+
assert.strictEqual(Number(score) >= 0.7, true, "(please first check if you can access https://antcpt.com/score_detector/.) Recaptcha V3 Score (hard) should be >=0.7. Score Result: " + score)
112123
})

0 commit comments

Comments
 (0)