selenium-stealth-fixed

Evade selenium detection from websites

Usage no npm install needed!

<script type="module">
  import seleniumStealthFixed from 'https://cdn.skypack.dev/selenium-stealth-fixed';
</script>

README

selenium-stealth (FORK) Build Status

Fork in order to fix webdriver compatibility issues.

A nodejs package selenium-stealth to prevent detection. This programme is trying to make nodejs selenium more stealthy.

As of now selenium-stealth

  • Only support Selenium Chrome/Chromium
  • Only works with selenium 4
  • Only works on the first tab open by the browser

After using selenium-stealth you can prevent almost all selenium detections.


This a nodeJs version of selenium stealth forked from the python version.
And the python version is a re-implementation of JavaScript puppeteer-extra-plugin-stealth developed by @berstend.


Features that currently selenium-stealth can offer:

  • ✅️ selenium-stealth with stealth passes all public bot tests.

  • ✅️ With selenium-stealth selenium can do google account login.

  • ✅️ selenium-stealth help with maintaining a normal reCAPTCHA v3 score

Install

Selenium-stealth is available on npm.

$ npm install selenium-stealth-fixed

Usage

const SeleniumStealth = require("./selenium_stealth");
const {Builder} = require('selenium-webdriver');

const driver = new Builder()
    .withCapabilities({
        'goog:chromeOptions': {
            excludeSwitches: [
                'enable-automation',
                'useAutomationExtension',
            ],
        },
    })
    .forBrowser('chrome')
    .build();

const seleniumStealth = new SeleniumStealth(driver)
await seleniumStealth.stealth({
    languages: ["en-US", "en"],
    vendor: "Google Inc.",
    platform: "Win32",
    webglVendor: "Intel Inc.",
    renderer: "Intel Iris OpenGL Engine",
    fixHairline: true
})
driver.get("https://bot.sannysoft.com/");

Args

new SeleniumStealth(driver: Driver)


seleniumStealth.stealth(
       userAgent: string= "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.53 Safari/537.36",
       languages: [string]= ["en-US", "en"],
       vendor: string= "Google Inc.",
       platform: string= "Win32",
       webglVendor: string = "Intel Inc.",
       renderer: string = "Intel Iris OpenGL Engine",
       fixHairline: boolean = false,
       runOnInsecureOrigins: boolean = false
       )

Test results (red is bad)

Selenium without selenium-stealth 😢

headless
headful

Selenium with selenium-stealth 💯

headless
headful

License

Copyright © 2020, praise2112. Released under the MIT License.