# Make a headless window out of every window! Perfect for undetected chromedriver (Selenium) to pass bot detection in headless mode.
**_From https://github.com/ultrafunkamsterdam/undetected-chromedriver_**
"just to mention it another time, since some people have hard time reading: headless is still WIP. Raising issues is needless_"
It is of course not the same as Chromes built-in headless mode [that's why I called it PoorMansHeadless :)]
but it allows you to run several automation processes on your pc without getting disturbed all the time.
```python
pip install PoorMansHeadless
```
```python
# A simple way to get the hwnd for your window:
from PoorMansHeadless import FakeHeadless
hand = FakeHeadless.get_all_windows_with_handle()
hwnd = 2231030
self = FakeHeadless(hwnd)
```
```python
# The window will be hidden almost completely (99,99999%) . Because of the 0.00001,
# its execution is still a priority for the operating system.
# This little part is a one-pixel-line above the Windows taskbar.
# Too small to see/interact/interfere, but big enough
# to avoid standby mode/rescource saving.
```
```python
# if you pass None as width and height, the window won't be resized, just moved.
# The upper part will be placed one pixel above the taskbar (distance_from_taskbar)
self.start_headless_mode(width=None, height=None, distance_from_taskbar=1)
```
```python
# To check if everything is going well in your headless window you can either start a video stream:
self.start_video_stream()
# or save screenshots to the HDD:
self.start_saving_screenshots(
folder="c:\\pictest4", frequency=1
) # if the folder doesn't exist, it will be created. Frequency=1 means one screenshot every second
```
```python
# if you have seen enough, you can stop the video/screenshot stream by calling:
self.disable_save_screenshots()
self.disable_video_stream()
# if you want to quit the headless mode, use:
self.quit_headless_mode()
```
```python
# By the way, if you are stuck in topmost mode (window on top of everything) after quitting the headless mode, use
self.activate()
# to set the hierachy back to normal. It happens sometimes when you use your mouse or keyboard,
# while quitting the headless mode.
```
```python
# The module contains some additional methods (resizing, invisibility, color substitution ... )
# Most of them are used as "helper methods" for the principal
# purpose of this package. But they also can be used on their own.
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/PoorMansHeadless",
"name": "PoorMansHeadless",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "headless,selenium,automation",
"author": "Johannes Fischer",
"author_email": "<aulasparticularesdealemaosp@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/f9/db/ec72884fe4abb60d92c6233c0b062ed58d81c912272e9c0c2f8f2c1f15f1/PoorMansHeadless-0.10.tar.gz",
"platform": null,
"description": "\n# Make a headless window out of every window! Perfect for undetected chromedriver (Selenium) to pass bot detection in headless mode.\n\n\n\n**_From https://github.com/ultrafunkamsterdam/undetected-chromedriver_**\n\n\"just to mention it another time, since some people have hard time reading: headless is still WIP. Raising issues is needless_\"\n\n\n\nIt is of course not the same as Chromes built-in headless mode [that's why I called it PoorMansHeadless :)]\n\nbut it allows you to run several automation processes on your pc without getting disturbed all the time.\n\n\n\n```python\n\npip install PoorMansHeadless\n\n```\n\n\n\n```python\n\n# A simple way to get the hwnd for your window:\n\nfrom PoorMansHeadless import FakeHeadless\n\nhand = FakeHeadless.get_all_windows_with_handle()\n\nhwnd = 2231030\n\nself = FakeHeadless(hwnd)\n\n```\n\n\n\n```python\n\n# The window will be hidden almost completely (99,99999%) . Because of the 0.00001, \n\n# its execution is still a priority for the operating system. \n\n# This little part is a one-pixel-line above the Windows taskbar.\n\n# Too small to see/interact/interfere, but big enough\n\n# to avoid standby mode/rescource saving. \n\n```\n\n\n\n```python\n\n# if you pass None as width and height, the window won't be resized, just moved. \n\n# The upper part will be placed one pixel above the taskbar (distance_from_taskbar)\n\nself.start_headless_mode(width=None, height=None, distance_from_taskbar=1) \n\n```\n\n\n\n```python\n\n# To check if everything is going well in your headless window you can either start a video stream:\n\nself.start_video_stream()\n\n\n\n# or save screenshots to the HDD:\n\nself.start_saving_screenshots(\n\n folder=\"c:\\\\pictest4\", frequency=1\n\n) # if the folder doesn't exist, it will be created. Frequency=1 means one screenshot every second\n\n```\n\n\n\n```python\n\n# if you have seen enough, you can stop the video/screenshot stream by calling:\n\nself.disable_save_screenshots()\n\nself.disable_video_stream()\n\n\n\n# if you want to quit the headless mode, use:\n\nself.quit_headless_mode()\n\n```\n\n\n\n```python\n\n# By the way, if you are stuck in topmost mode (window on top of everything) after quitting the headless mode, use \n\nself.activate() \n\n# to set the hierachy back to normal. It happens sometimes when you use your mouse or keyboard, \n\n# while quitting the headless mode. \n\n```\n\n\n\n```python\n\n# The module contains some additional methods (resizing, invisibility, color substitution ... )\n\n# Most of them are used as \"helper methods\" for the principal\n\n# purpose of this package. But they also can be used on their own.\n\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Make a headless window out of every window! Perfect for undetected chromedriver (Selenium) to pass bot detection in headless mode.",
"version": "0.10",
"split_keywords": [
"headless",
"selenium",
"automation"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "26491ed05e7f7c3f6d0bc61e01b654f4",
"sha256": "d316f1804c351bc21271a55e91f058517733a3e1b38a8237b5d62e6e63135ff8"
},
"downloads": -1,
"filename": "PoorMansHeadless-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "26491ed05e7f7c3f6d0bc61e01b654f4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 9781,
"upload_time": "2022-12-23T20:46:18",
"upload_time_iso_8601": "2022-12-23T20:46:18.475966Z",
"url": "https://files.pythonhosted.org/packages/89/a7/fb247cc3ddba423ad8f6ce28aa813df1baae5355fbda54581f1a7011215e/PoorMansHeadless-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "286a9ed75337c426d24f084604bc10fc",
"sha256": "197d56a398b868ee2a212437e9effdffbe1784d839a1bda4a53a3b995ab55faa"
},
"downloads": -1,
"filename": "PoorMansHeadless-0.10.tar.gz",
"has_sig": false,
"md5_digest": "286a9ed75337c426d24f084604bc10fc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8285,
"upload_time": "2022-12-23T20:46:19",
"upload_time_iso_8601": "2022-12-23T20:46:19.977176Z",
"url": "https://files.pythonhosted.org/packages/f9/db/ec72884fe4abb60d92c6233c0b062ed58d81c912272e9c0c2f8f2c1f15f1/PoorMansHeadless-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-23 20:46:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "hansalemaos",
"github_project": "PoorMansHeadless",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "a_cv_imwrite_imread_plus",
"specs": []
},
{
"name": "ctypes_screenshots",
"specs": []
},
{
"name": "ctypes_window_info",
"specs": []
},
{
"name": "kthread",
"specs": []
},
{
"name": "opencv_python",
"specs": []
},
{
"name": "pandas",
"specs": []
}
],
"lcname": "poormansheadless"
}