selenium-stealth


Nameselenium-stealth JSON
Version 1.0.6 PyPI version JSON
download
home_pagehttps://github.com/diprajpatra/selenium-stealth
SummaryTrying to make python selenium more stealthy.
upload_time2020-11-05 15:26:05
maintainer
docs_urlNone
authorDipraj Patra
requires_python>=3, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
license
keywords
VCS
bugtrack_url
requirements selenium flake8 pytest
Travis-CI
coveralls test coverage No coveralls.
            # selenium-stealth [![Build Status](https://travis-ci.com/diprajpatra/selenium-stealth.svg?branch=main)](https://travis-ci.com/diprajpatra/selenium-stealth)

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

As of now selenium-stealth **only support Selenium Chrome**.

After using selenium-stealth you can prevent almost all selenium detections. There is a lot of guides on stackoverflow on How to prevent selenium detection but I can not find a single python package for it so I am just creating one after all we can't let the cats win.
It can be seen as a re-implementation of JavaScript [puppeteer-extra-plugin-stealth](https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth) developed by [@berstend](https://github.com/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**

## Donations
If you find this package useful and would like to support its continued development, you can donate here. Thank you for your support.

[![Donate Via PayPal](https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif)](https://paypal.me/diprajpatra)

[<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png"  width="120" height="30">](https://www.buymeacoffee.com/dipraj)
## Install
Selenium-stealth is available on PyPI you can install with pip.
```
$ pip install selenium-stealth
```

## Usage

```python
from selenium import webdriver
from selenium_stealth import stealth
import time

options = webdriver.ChromeOptions()
options.add_argument("start-maximized")

# options.add_argument("--headless")

options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(options=options, executable_path=r"C:\Users\DIPRAJ\Programming\adclick_bot\chromedriver.exe")

stealth(driver,
        languages=["en-US", "en"],
        vendor="Google Inc.",
        platform="Win32",
        webgl_vendor="Intel Inc.",
        renderer="Intel Iris OpenGL Engine",
        fix_hairline=True,
        )

url = "https://bot.sannysoft.com/"
driver.get(url)
time.sleep(5)
driver.quit()
```

## Args

```python
stealth(
    driver: Driver,
    user_agent: str = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.53 Safari/537.36',
    languages: [str] = ["en-US", "en"],
    vendor: str = "Google Inc.",
    platform: str = "Win32",
    webgl_vendor: str = "Intel Inc.",
    renderer: str = "Intel Iris OpenGL Engine",
    fix_hairline: bool = False,
    run_on_insecure_origins: bool = False,
)
```

## Test results (red is bad)

### Selenium without <strong>selenium-stealth 😢</strong>

<table class="image">
<tr>
  <td><figure class="image"><a href="https://raw.githubusercontent.com/diprajpatra/selenium-stealth/main/stealthtests/selenium_chrome_headless_without_stealth.png"><img src="https://raw.githubusercontent.com/diprajpatra/selenium-stealth/main/stealthtests/selenium_chrome_headless_without_stealth.png"></a><figcaption>headless</figcaption></figure></td>
  <td><figure class="image"><a href="https://raw.githubusercontent.com/diprajpatra/selenium-stealth/main/stealthtests/selenium_chrome_headful_without_stealth.png"><img src="https://raw.githubusercontent.com/diprajpatra/selenium-stealth/main/stealthtests/selenium_chrome_headful_without_stealth.png"></a><figcaption>headful</figcaption></figure></td>
</tr>
</table>

### Selenium with <strong>selenium-stealth 💯</strong>

<table class="image">
<tr>
  <td><figure class="image"><a href="https://raw.githubusercontent.com/diprajpatra/selenium-stealth/main/stealthtests/selenium_chrome_headless_with_stealth.png"><img src="https://raw.githubusercontent.com/diprajpatra/selenium-stealth/main/stealthtests/selenium_chrome_headless_with_stealth.png"></a><figcaption>headless</figcaption></figure></td>
  <td><figure class="image"><a href="https://raw.githubusercontent.com/diprajpatra/selenium-stealth/main/stealthtests/selenium_chrome_headful_with_stealth.png"><img src="https://raw.githubusercontent.com/diprajpatra/selenium-stealth/main/stealthtests/selenium_chrome_headful_with_stealth.png"></a><figcaption>headful</figcaption></figure></td>
</tr>
</table>

## License

Copyright © 2020, [diprajpatra](https://github.com/diprajpatra). Released under the MIT License.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/diprajpatra/selenium-stealth",
    "name": "selenium-stealth",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
    "maintainer_email": "",
    "keywords": "",
    "author": "Dipraj Patra",
    "author_email": "diprajpatra@gmail.com",
    "download_url": "",
    "platform": "",
    "description": "# selenium-stealth [![Build Status](https://travis-ci.com/diprajpatra/selenium-stealth.svg?branch=main)](https://travis-ci.com/diprajpatra/selenium-stealth)\n\nA python package **selenium-stealth** to prevent detection. This programme is trying to make python selenium more stealthy. \n\nAs of now selenium-stealth **only support Selenium Chrome**.\n\nAfter using selenium-stealth you can prevent almost all selenium detections. There is a lot of guides on stackoverflow on How to prevent selenium detection but I can not find a single python package for it so I am just creating one after all we can't let the cats win.\nIt can be seen as a re-implementation of JavaScript [puppeteer-extra-plugin-stealth](https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth) developed by [@berstend](https://github.com/berstend>).\n\nFeatures that currently selenium-stealth can offer:\n\n- \u2705\ufe0f **`selenium-stealth` with stealth passes all public bot tests.**\n\n- \u2705\ufe0f **With `selenium-stealth` selenium can do google account login.**\n\n- \u2705\ufe0f **`selenium-stealth` help with maintaining a normal reCAPTCHA v3 score**\n\n## Donations\nIf you find this package useful and would like to support its continued development, you can donate here. Thank you for your support.\n\n[![Donate Via PayPal](https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif)](https://paypal.me/diprajpatra)\n\n[<img src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\"  width=\"120\" height=\"30\">](https://www.buymeacoffee.com/dipraj)\n## Install\nSelenium-stealth is available on PyPI you can install with pip.\n```\n$ pip install selenium-stealth\n```\n\n## Usage\n\n```python\nfrom selenium import webdriver\nfrom selenium_stealth import stealth\nimport time\n\noptions = webdriver.ChromeOptions()\noptions.add_argument(\"start-maximized\")\n\n# options.add_argument(\"--headless\")\n\noptions.add_experimental_option(\"excludeSwitches\", [\"enable-automation\"])\noptions.add_experimental_option('useAutomationExtension', False)\ndriver = webdriver.Chrome(options=options, executable_path=r\"C:\\Users\\DIPRAJ\\Programming\\adclick_bot\\chromedriver.exe\")\n\nstealth(driver,\n        languages=[\"en-US\", \"en\"],\n        vendor=\"Google Inc.\",\n        platform=\"Win32\",\n        webgl_vendor=\"Intel Inc.\",\n        renderer=\"Intel Iris OpenGL Engine\",\n        fix_hairline=True,\n        )\n\nurl = \"https://bot.sannysoft.com/\"\ndriver.get(url)\ntime.sleep(5)\ndriver.quit()\n```\n\n## Args\n\n```python\nstealth(\n    driver: Driver,\n    user_agent: str = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.53 Safari/537.36',\n    languages: [str] = [\"en-US\", \"en\"],\n    vendor: str = \"Google Inc.\",\n    platform: str = \"Win32\",\n    webgl_vendor: str = \"Intel Inc.\",\n    renderer: str = \"Intel Iris OpenGL Engine\",\n    fix_hairline: bool = False,\n    run_on_insecure_origins: bool = False,\n)\n```\n\n## Test results (red is bad)\n\n### Selenium without <strong>selenium-stealth \ud83d\ude22</strong>\n\n<table class=\"image\">\n<tr>\n  <td><figure class=\"image\"><a href=\"https://raw.githubusercontent.com/diprajpatra/selenium-stealth/main/stealthtests/selenium_chrome_headless_without_stealth.png\"><img src=\"https://raw.githubusercontent.com/diprajpatra/selenium-stealth/main/stealthtests/selenium_chrome_headless_without_stealth.png\"></a><figcaption>headless</figcaption></figure></td>\n  <td><figure class=\"image\"><a href=\"https://raw.githubusercontent.com/diprajpatra/selenium-stealth/main/stealthtests/selenium_chrome_headful_without_stealth.png\"><img src=\"https://raw.githubusercontent.com/diprajpatra/selenium-stealth/main/stealthtests/selenium_chrome_headful_without_stealth.png\"></a><figcaption>headful</figcaption></figure></td>\n</tr>\n</table>\n\n### Selenium with <strong>selenium-stealth \ud83d\udcaf</strong>\n\n<table class=\"image\">\n<tr>\n  <td><figure class=\"image\"><a href=\"https://raw.githubusercontent.com/diprajpatra/selenium-stealth/main/stealthtests/selenium_chrome_headless_with_stealth.png\"><img src=\"https://raw.githubusercontent.com/diprajpatra/selenium-stealth/main/stealthtests/selenium_chrome_headless_with_stealth.png\"></a><figcaption>headless</figcaption></figure></td>\n  <td><figure class=\"image\"><a href=\"https://raw.githubusercontent.com/diprajpatra/selenium-stealth/main/stealthtests/selenium_chrome_headful_with_stealth.png\"><img src=\"https://raw.githubusercontent.com/diprajpatra/selenium-stealth/main/stealthtests/selenium_chrome_headful_with_stealth.png\"></a><figcaption>headful</figcaption></figure></td>\n</tr>\n</table>\n\n## License\n\nCopyright \u00a9 2020, [diprajpatra](https://github.com/diprajpatra). Released under the MIT License.\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Trying to make python selenium more stealthy.",
    "version": "1.0.6",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cbac7877df8b819d54a4e317a093a0a9e0a38d21d884a7250aa713f2f0869442",
                "md5": "39ac15a43062eedc1a34e384657d4c96",
                "sha256": "b62da5452aa4a84f29a4dfb21a9696aff20788a7c570dd0b81bc04a940848b97"
            },
            "downloads": -1,
            "filename": "selenium_stealth-1.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "39ac15a43062eedc1a34e384657d4c96",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
            "size": 32195,
            "upload_time": "2020-11-05T15:26:05",
            "upload_time_iso_8601": "2020-11-05T15:26:05.240256Z",
            "url": "https://files.pythonhosted.org/packages/cb/ac/7877df8b819d54a4e317a093a0a9e0a38d21d884a7250aa713f2f0869442/selenium_stealth-1.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-11-05 15:26:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "diprajpatra",
    "github_project": "selenium-stealth",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "selenium",
            "specs": []
        },
        {
            "name": "flake8",
            "specs": []
        },
        {
            "name": "pytest",
            "specs": []
        }
    ],
    "tox": true,
    "lcname": "selenium-stealth"
}
        
Elapsed time: 0.04525s