Socket
Book a DemoInstallSign in
Socket

selenium-stealth

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

selenium-stealth

Evade selenium detection from websites

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
11
266.67%
Maintainers
1
Weekly downloads
 
Created
Source

selenium-stealth Build Status

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

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 😢

headlessheadful

Selenium with selenium-stealth 💯

headlessheadful

License

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

FAQs

Package last updated on 23 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts