s-tool


Names-tool JSON
Version 0.0.5 PyPI version JSON
download
home_pagehttps://github.com/Python-World/s-tool
SummarySelenium wrapper to make your life easy.
upload_time2023-07-01 19:59:26
maintainer
docs_urlNone
authorRavishankar Chavare
requires_python>=3.11,<4.0
licenseMIT
keywords python selenium wrapper webdriver tools utilities
VCS
bugtrack_url
requirements lxml selenium webdriver-manager
Travis-CI No Travis.
coveralls test coverage No coveralls.
            **S-TOOL**

.. image:: https://user-images.githubusercontent.com/33047641/125023819-41998700-e09d-11eb-8076-7fad81f98f70.png
   :width: 150


``S-Tool`` is a utility module that provides helpful methods for interacting with Selenium WebDriver in Python

Installation
^^^^^^^^^^^^

Installation using PyPi
-----------------------

.. code:: bash

    pip install s-tool


Development Setup
-----------------

.. code:: bash

   # Clone this repository
    git clone https://github.com/Python-World/s-tool.git

    # Go into the repository
    cd sel-kit

    # Install dependencies
    poetry config virtualenvs.in-project true
    poetry install

    # Start Poetry shell
    poetry shell



Usage
^^^^^

* Example Using Context Manager

.. code-block:: python

    """Example code with context manager"""

    from s_tool.core import SeleniumTools as SBot

    with SBot(browser="firefox", headless=True) as self:
        self.get("https://example.com")
        sessionid = self.sessionid()
        url = self.url()
        cookies = self.cookies()

        # print sessionid,url,cookies
        print(f"\nurl     :   {url} \nsession :   {sessionid}\ncookies :   {cookies}\n")
     

* Example Using class

.. code-block:: python 

    from s_tool.core import SeleniumTools

    class SBot(SeleniumTools):
        """Example Bot using s-tool"""

        def __init__(self, *args, **kwargs):
            super().__init__(*args, **kwargs)

        def run(self):
            """Code to visit url and fetch cookies and basic info"""
            url ="https://example.com"
            self.get(url)
            sessionid = self.sessionid()
            url = self.url()
            cookies = self.cookies()

            # print sessionid,url,cookies
            print(f"\nurl     :   {url} \nsession :   {sessionid}\ncookies :   {cookies}\n")


    bot = SBot(browser ="firefox", headless=True)  # change headless=False to run with gui mode
    bot.run()
    bot._close()

Methods
^^^^^^^

Here are the public methods available in the SeleniumTools class:
    - get(): Loads a web page with the specified URL or local file or Html Content.
    - url(): Returns the current URL of the page.
    - text(): Returns the source code of the current page.
    - get_driver_sessionid(): Return an session id string.
    - get_locator(): Returns a WebDriver locator based on the given element identifier and identifier type.
    - get_element(): Returns a single element or a list of elements matching the given element identifier and identifier type.
    - fill(): Fills in form elements with the provided values.
    - wait_for_element(): Waits for an element to be present and visible on the page.
    - element_visibility(): Toggles the visibility of an element on the page.
    - cookies(): Returns all cookies present in the current session.
    - set_cookies(): Sets cookies for the current session using a dictionary of cookie key-value pairs.
    - click(): Clicks on the element identified by the given element identifier and identifier type.
    - press_multiple_keys(): Presses multiple keys simultaneously using Selenium.
    - execute_script(): Executes JavaScript code in the context of the current page.
    - parse(): Parses the HTML content of the current page and returns a list of elements matching the given tag name and attribute value.
    


Feel free to refer to the documentation for each method to understand their parameters and usage.

Contributing
^^^^^^^^^^^^

Contributions are welcome! If you find any issues or have suggestions for improvement, please create an issue or submit a pull request.

License
-------
This project is licensed under the MIT License.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Python-World/s-tool",
    "name": "s-tool",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11,<4.0",
    "maintainer_email": "",
    "keywords": "Python,Selenium,wrapper,Webdriver,Tools,Utilities",
    "author": "Ravishankar Chavare",
    "author_email": "chavare.ravi123@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/cd/7b/6e708116f0848bcf4fecb4fb7b9f29e1c686087a5dc30c9fe1ccec418a73/s_tool-0.0.5.tar.gz",
    "platform": null,
    "description": "**S-TOOL**\n\n.. image:: https://user-images.githubusercontent.com/33047641/125023819-41998700-e09d-11eb-8076-7fad81f98f70.png\n   :width: 150\n\n\n``S-Tool`` is a utility module that provides helpful methods for interacting with Selenium WebDriver in Python\n\nInstallation\n^^^^^^^^^^^^\n\nInstallation using PyPi\n-----------------------\n\n.. code:: bash\n\n    pip install s-tool\n\n\nDevelopment Setup\n-----------------\n\n.. code:: bash\n\n   # Clone this repository\n    git clone https://github.com/Python-World/s-tool.git\n\n    # Go into the repository\n    cd sel-kit\n\n    # Install dependencies\n    poetry config virtualenvs.in-project true\n    poetry install\n\n    # Start Poetry shell\n    poetry shell\n\n\n\nUsage\n^^^^^\n\n* Example Using Context Manager\n\n.. code-block:: python\n\n    \"\"\"Example code with context manager\"\"\"\n\n    from s_tool.core import SeleniumTools as SBot\n\n    with SBot(browser=\"firefox\", headless=True) as self:\n        self.get(\"https://example.com\")\n        sessionid = self.sessionid()\n        url = self.url()\n        cookies = self.cookies()\n\n        # print sessionid,url,cookies\n        print(f\"\\nurl     :   {url} \\nsession :   {sessionid}\\ncookies :   {cookies}\\n\")\n     \n\n* Example Using class\n\n.. code-block:: python \n\n    from s_tool.core import SeleniumTools\n\n    class SBot(SeleniumTools):\n        \"\"\"Example Bot using s-tool\"\"\"\n\n        def __init__(self, *args, **kwargs):\n            super().__init__(*args, **kwargs)\n\n        def run(self):\n            \"\"\"Code to visit url and fetch cookies and basic info\"\"\"\n            url =\"https://example.com\"\n            self.get(url)\n            sessionid = self.sessionid()\n            url = self.url()\n            cookies = self.cookies()\n\n            # print sessionid,url,cookies\n            print(f\"\\nurl     :   {url} \\nsession :   {sessionid}\\ncookies :   {cookies}\\n\")\n\n\n    bot = SBot(browser =\"firefox\", headless=True)  # change headless=False to run with gui mode\n    bot.run()\n    bot._close()\n\nMethods\n^^^^^^^\n\nHere are the public methods available in the SeleniumTools class:\n    - get(): Loads a web page with the specified URL or local file or Html Content.\n    - url(): Returns the current URL of the page.\n    - text(): Returns the source code of the current page.\n    - get_driver_sessionid(): Return an session id string.\n    - get_locator(): Returns a WebDriver locator based on the given element identifier and identifier type.\n    - get_element(): Returns a single element or a list of elements matching the given element identifier and identifier type.\n    - fill(): Fills in form elements with the provided values.\n    - wait_for_element(): Waits for an element to be present and visible on the page.\n    - element_visibility(): Toggles the visibility of an element on the page.\n    - cookies(): Returns all cookies present in the current session.\n    - set_cookies(): Sets cookies for the current session using a dictionary of cookie key-value pairs.\n    - click(): Clicks on the element identified by the given element identifier and identifier type.\n    - press_multiple_keys(): Presses multiple keys simultaneously using Selenium.\n    - execute_script(): Executes JavaScript code in the context of the current page.\n    - parse(): Parses the HTML content of the current page and returns a list of elements matching the given tag name and attribute value.\n    \n\n\nFeel free to refer to the documentation for each method to understand their parameters and usage.\n\nContributing\n^^^^^^^^^^^^\n\nContributions are welcome! If you find any issues or have suggestions for improvement, please create an issue or submit a pull request.\n\nLicense\n-------\nThis project is licensed under the MIT License.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Selenium wrapper to make your life easy.",
    "version": "0.0.5",
    "project_urls": {
        "Homepage": "https://github.com/Python-World/s-tool",
        "Repository": "https://github.com/Python-World/s-tool"
    },
    "split_keywords": [
        "python",
        "selenium",
        "wrapper",
        "webdriver",
        "tools",
        "utilities"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4e0f25313d845199c5861e38fcc7762540c81c0d448ceee8feb5fdd984997229",
                "md5": "32f92cdf19f5c3438496b48a56c8f2ec",
                "sha256": "7b9e8f000e70573e5045baa596937246b2fb380838020c72bbceb410869230ab"
            },
            "downloads": -1,
            "filename": "s_tool-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "32f92cdf19f5c3438496b48a56c8f2ec",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11,<4.0",
            "size": 11978,
            "upload_time": "2023-07-01T19:59:24",
            "upload_time_iso_8601": "2023-07-01T19:59:24.968591Z",
            "url": "https://files.pythonhosted.org/packages/4e/0f/25313d845199c5861e38fcc7762540c81c0d448ceee8feb5fdd984997229/s_tool-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cd7b6e708116f0848bcf4fecb4fb7b9f29e1c686087a5dc30c9fe1ccec418a73",
                "md5": "9587317a5641ccdbeedfdbcd33758a92",
                "sha256": "04d5e76dba32ba1dd639f3754bd4b7191fc3150e316f37cec88653f6c30bd5cf"
            },
            "downloads": -1,
            "filename": "s_tool-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "9587317a5641ccdbeedfdbcd33758a92",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11,<4.0",
            "size": 11941,
            "upload_time": "2023-07-01T19:59:26",
            "upload_time_iso_8601": "2023-07-01T19:59:26.718220Z",
            "url": "https://files.pythonhosted.org/packages/cd/7b/6e708116f0848bcf4fecb4fb7b9f29e1c686087a5dc30c9fe1ccec418a73/s_tool-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-01 19:59:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Python-World",
    "github_project": "s-tool",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "lxml",
            "specs": [
                [
                    "==",
                    "4.9.2"
                ]
            ]
        },
        {
            "name": "selenium",
            "specs": [
                [
                    "==",
                    "4.9.1"
                ]
            ]
        },
        {
            "name": "webdriver-manager",
            "specs": [
                [
                    "==",
                    "3.8.6"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "s-tool"
}
        
Elapsed time: 0.08214s