selmate


Nameselmate JSON
Version 1.3.2 PyPI version JSON
download
home_pagehttps://github.com/FINWAX/selmate.py
SummaryA utility library for Selenium WebDriver to enable human-like interactions, robust exception handling, and web automation tasks like popup handling and URL normalization.
upload_time2025-08-03 13:50:24
maintainerNone
docs_urlNone
authorFINWAX
requires_python>=3.10
licenseMIT License Copyright (c) 2025 FINWAX Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords selenium web automation human-like web scraping browser automation popup handling url normalization testing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Selmate

Selmate is a Python utility library designed to enhance Selenium WebDriver automation by providing human-like
interactions, robust exception handling, and utilities for common web automation tasks. It simplifies interactions with
web elements, handles popups, normalizes URLs, and simulates natural user behavior like mouse movements and scrolling.

## Features

- **Safe Element Interactions**: Wrappers for Selenium operations (clicks, scrolls, etc.) with built-in exception
  handling for stale elements, timeouts, and more.
- **Human-Like Behavior**: Simulates realistic mouse movements, scrolling, and latency to mimic human interactions.
- **Popup Handling**: Automatically detects and handles popup banners, including those within iframes, with options to
  accept or close them.
- **URL Normalization**: Utilities to normalize URLs relative to a base URL, with configurable handling of query
  strings, fragments, and parameters.
- **JavaScript Integration**: Execute JavaScript for advanced interactions like smooth scrolling, element removal, and
  visibility checks.
- **Text Similarity**: Identify confirmation buttons or close buttons using fuzzy text matching.

## Installation

Install Selmate via pip:

```bash
pip install selmate
```

## Usage

Here are some examples of using Selmate's core functionalities:

### Example 1: Safe Element Click

```python
from selenium import webdriver
from selmate.composites import complex_click
from selmate.selenium_primitives import find_element_safely
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get("https://example.com")

# Safely find and click a button
button = find_element_safely(By.ID, "submit-button", driver)
if button and complex_click(button, driver):
    print("Button clicked successfully")

driver.quit()
```

### Example 2: Handling Popup Banners

```python
from selenium import webdriver
from selmate.composites import bypass_popup_banners

driver = webdriver.Chrome()
driver.get("https://example.com")

# Automatically handle popup banners
bypass_popup_banners(driver, observation_capacity=50, success_capacity=3, try_close=True)
print("Popups handled")

driver.quit()
```

### Example 3: Human-Like Mouse Movement

```python
from selenium import webdriver
from selmate.composites import wander_between_2_elements
from selmate.selenium_primitives import find_element_safely
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get("https://example.com")

# Find two elements and simulate mouse movement between them
element1 = find_element_safely(By.ID, "element1", driver)
element2 = find_element_safely(By.ID, "element2", driver)
if element1 and element2:
    wander_between_2_elements(element1, element2, driver)

driver.quit()
```

## License

Selmate is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Contact

For questions or support, open an issue or contact the maintainer at waxbid@gmail.com.
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/FINWAX/selmate.py",
    "name": "selmate",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "selenium, web automation, human-like, web scraping, browser automation, popup handling, url normalization, testing",
    "author": "FINWAX",
    "author_email": "waxbid@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7a/e3/636b67eb8d96f769cad9bae74ee678d9361ff0939f4d1b8ef860314b98ed/selmate-1.3.2.tar.gz",
    "platform": null,
    "description": "# Selmate\n\nSelmate is a Python utility library designed to enhance Selenium WebDriver automation by providing human-like\ninteractions, robust exception handling, and utilities for common web automation tasks. It simplifies interactions with\nweb elements, handles popups, normalizes URLs, and simulates natural user behavior like mouse movements and scrolling.\n\n## Features\n\n- **Safe Element Interactions**: Wrappers for Selenium operations (clicks, scrolls, etc.) with built-in exception\n  handling for stale elements, timeouts, and more.\n- **Human-Like Behavior**: Simulates realistic mouse movements, scrolling, and latency to mimic human interactions.\n- **Popup Handling**: Automatically detects and handles popup banners, including those within iframes, with options to\n  accept or close them.\n- **URL Normalization**: Utilities to normalize URLs relative to a base URL, with configurable handling of query\n  strings, fragments, and parameters.\n- **JavaScript Integration**: Execute JavaScript for advanced interactions like smooth scrolling, element removal, and\n  visibility checks.\n- **Text Similarity**: Identify confirmation buttons or close buttons using fuzzy text matching.\n\n## Installation\n\nInstall Selmate via pip:\n\n```bash\npip install selmate\n```\n\n## Usage\n\nHere are some examples of using Selmate's core functionalities:\n\n### Example 1: Safe Element Click\n\n```python\nfrom selenium import webdriver\nfrom selmate.composites import complex_click\nfrom selmate.selenium_primitives import find_element_safely\nfrom selenium.webdriver.common.by import By\n\ndriver = webdriver.Chrome()\ndriver.get(\"https://example.com\")\n\n# Safely find and click a button\nbutton = find_element_safely(By.ID, \"submit-button\", driver)\nif button and complex_click(button, driver):\n    print(\"Button clicked successfully\")\n\ndriver.quit()\n```\n\n### Example 2: Handling Popup Banners\n\n```python\nfrom selenium import webdriver\nfrom selmate.composites import bypass_popup_banners\n\ndriver = webdriver.Chrome()\ndriver.get(\"https://example.com\")\n\n# Automatically handle popup banners\nbypass_popup_banners(driver, observation_capacity=50, success_capacity=3, try_close=True)\nprint(\"Popups handled\")\n\ndriver.quit()\n```\n\n### Example 3: Human-Like Mouse Movement\n\n```python\nfrom selenium import webdriver\nfrom selmate.composites import wander_between_2_elements\nfrom selmate.selenium_primitives import find_element_safely\nfrom selenium.webdriver.common.by import By\n\ndriver = webdriver.Chrome()\ndriver.get(\"https://example.com\")\n\n# Find two elements and simulate mouse movement between them\nelement1 = find_element_safely(By.ID, \"element1\", driver)\nelement2 = find_element_safely(By.ID, \"element2\", driver)\nif element1 and element2:\n    wander_between_2_elements(element1, element2, driver)\n\ndriver.quit()\n```\n\n## License\n\nSelmate is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Contact\n\nFor questions or support, open an issue or contact the maintainer at waxbid@gmail.com.",
    "bugtrack_url": null,
    "license": "MIT License\n\nCopyright (c) 2025 FINWAX\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.",
    "summary": "A utility library for Selenium WebDriver to enable human-like interactions, robust exception handling, and web automation tasks like popup handling and URL normalization.",
    "version": "1.3.2",
    "project_urls": {
        "Homepage": "https://github.com/FINWAX/selmate.py",
        "Repository": "https://github.com/FINWAX/selmate.py"
    },
    "split_keywords": [
        "selenium",
        " web automation",
        " human-like",
        " web scraping",
        " browser automation",
        " popup handling",
        " url normalization",
        " testing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e77f7f8143af9b51cde95e9960b1f85b9ebb7d1c0e7eebfc66a9009b0e5dd54d",
                "md5": "fb3fe60ef99ea9b1df863b6846af5d31",
                "sha256": "4534ae11b023a423a0bd6c55bc4f95183ad5270255efd15cc8b596d3d8f4afec"
            },
            "downloads": -1,
            "filename": "selmate-1.3.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fb3fe60ef99ea9b1df863b6846af5d31",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 18586,
            "upload_time": "2025-08-03T13:50:22",
            "upload_time_iso_8601": "2025-08-03T13:50:22.724804Z",
            "url": "https://files.pythonhosted.org/packages/e7/7f/7f8143af9b51cde95e9960b1f85b9ebb7d1c0e7eebfc66a9009b0e5dd54d/selmate-1.3.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7ae3636b67eb8d96f769cad9bae74ee678d9361ff0939f4d1b8ef860314b98ed",
                "md5": "61bd9aa23fcd23e8685ef7744b98f08e",
                "sha256": "583c177f39a912f3979683491c130f9060fab149d7a893461c90cc16594e3002"
            },
            "downloads": -1,
            "filename": "selmate-1.3.2.tar.gz",
            "has_sig": false,
            "md5_digest": "61bd9aa23fcd23e8685ef7744b98f08e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 16985,
            "upload_time": "2025-08-03T13:50:24",
            "upload_time_iso_8601": "2025-08-03T13:50:24.016389Z",
            "url": "https://files.pythonhosted.org/packages/7a/e3/636b67eb8d96f769cad9bae74ee678d9361ff0939f4d1b8ef860314b98ed/selmate-1.3.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-03 13:50:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "FINWAX",
    "github_project": "selmate.py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "selmate"
}
        
Elapsed time: 1.77000s