Skip to content

Commit

Permalink
New test added.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdervisaygan committed Sep 9, 2024
1 parent 7e4be30 commit 1b0851d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppeteer-real-browser",
"version": "1.3.10",
"version": "1.3.11",
"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.",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.mjs",
Expand Down
34 changes: 22 additions & 12 deletions test/cjs/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,28 @@ test('Cloudflare Turnstile', async () => {
})


test('Fingerprint JS Bot Detector', async () => {
const { page, browser } = await connect(realBrowserOption)
await page.goto("https://fingerprint.com/products/bot-detection/");
await new Promise(r => setTimeout(r, 5000));
const detect = await page.evaluate(() => {
return document.querySelector('.HeroSection-module--botSubTitle--2711e').textContent.includes("not") ? true : false
})
await browser.close()
assert.strictEqual(detect, true, "Fingerprint JS Bot Detector test failed!")
})


// If you fail this test, your ip address probably has a high spam score. Please use a mobile or clean ip address.
test('Datadome Bot Detector', async (t) => {
const { page, browser } = await connect(realBrowserOption)
await page.goto("https://antoinevastel.com/bots/datadome");
const check = await page.waitForSelector('nav #navbarCollapse').catch(() => null)
await browser.close()
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.]")
})

// If this test fails, please first check if you can access https://antcpt.com/score_detector/
test('Recaptcha V3 Score (hard)', async () => {
const { page, browser } = await connect(realBrowserOption)
await page.goto("https://antcpt.com/score_detector/");
Expand All @@ -95,16 +116,5 @@ test('Recaptcha V3 Score (hard)', async () => {
})
await browser.close()
// if (Number(score) >= 0.7) console.log('Recaptcha V3 Score: ' + score);
assert.strictEqual(Number(score) >= 0.7, true, "Recaptcha V3 Score (hard) should be >=0.7. Score Result: " + score)
})

test('Fingerprint JS Bot Detector', async () => {
const { page, browser } = await connect(realBrowserOption)
await page.goto("https://fingerprint.com/products/bot-detection/");
await new Promise(r => setTimeout(r, 5000));
const detect = await page.evaluate(() => {
return document.querySelector('.HeroSection-module--botSubTitle--2711e').textContent.includes("not") ? true : false
})
await browser.close()
assert.strictEqual(detect, true, "Fingerprint JS Bot Detector test failed!")
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)
})
35 changes: 23 additions & 12 deletions test/esm/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,26 +87,37 @@ test('Cloudflare Turnstile', async () => {



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

test('Fingerprint JS Bot Detector', async () => {

// If you fail this test, your ip address probably has a high spam score. Please use a mobile or clean ip address.
test('Datadome Bot Detector', async (t) => {
const { page, browser } = await connect(realBrowserOption)
await page.goto("https://fingerprint.com/products/bot-detection/");
await page.goto("https://antoinevastel.com/bots/datadome");
const check = await page.waitForSelector('nav #navbarCollapse').catch(() => null)
await browser.close()
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.]")
})

// If this test fails, please first check if you can access https://antcpt.com/score_detector/
test('Recaptcha V3 Score (hard)', async () => {
const { page, browser } = await connect(realBrowserOption)
await page.goto("https://antcpt.com/score_detector/");
await page.realClick("button")
await new Promise(r => setTimeout(r, 5000));
const detect = await page.evaluate(() => {
return document.querySelector('.HeroSection-module--botSubTitle--2711e').textContent.includes("not") ? true : false
const score = await page.evaluate(() => {
return document.querySelector('big').textContent.replace(/[^0-9.]/g, '')
})
await browser.close()
assert.strictEqual(detect, true, "Fingerprint JS Bot Detector test failed!")
// if (Number(score) >= 0.7) console.log('Recaptcha V3 Score: ' + score);
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)
})

0 comments on commit 1b0851d

Please sign in to comment.