{"id":18537281,"url":"https://github.com/nareshnavinash/selpy","last_synced_at":"2025-11-01T03:30:23.785Z","repository":{"id":57465413,"uuid":"235089226","full_name":"nareshnavinash/selpy","owner":"nareshnavinash","description":"Python Module to have common methods for POM selenium automation","archived":false,"fork":false,"pushed_at":"2020-01-23T08:54:54.000Z","size":247,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-26T06:46:25.541Z","etag":null,"topics":["pypi-package","python","snap-mode","support-module"],"latest_commit_sha":null,"homepage":"https://nareshnavinash.github.io/selpy/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nareshnavinash.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-20T11:46:48.000Z","updated_at":"2020-02-17T12:54:06.000Z","dependencies_parsed_at":"2022-09-13T13:40:51.175Z","dependency_job_id":null,"html_url":"https://github.com/nareshnavinash/selpy","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nareshnavinash%2Fselpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nareshnavinash%2Fselpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nareshnavinash%2Fselpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nareshnavinash%2Fselpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nareshnavinash","download_url":"https://codeload.github.com/nareshnavinash/selpy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239255294,"owners_count":19608253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pypi-package","python","snap-mode","support-module"],"created_at":"2024-11-06T19:37:42.741Z","updated_at":"2025-11-01T03:30:23.715Z","avatar_url":"https://github.com/nareshnavinash.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Selpy\n\nSelpy module is to have all the common methods that will be used in functional UI automation in Page Object Model. Selpy also powered to have snapshot feature that will save the data from UI to a file if needed. This in turn reduces the test data maintenance efforts.\n\n\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](LICENSE)\n[![Made with Python](https://img.shields.io/badge/Made%20with-Python-yellow.svg)](https://www.python.org/)\n[![StackOverflow](http://img.shields.io/badge/Stack%20Overflow-Ask-blue.svg)]( https://stackoverflow.com/users/10505289/naresh-sekar )\n[![Contributions Welcome](https://img.shields.io/badge/Contributions-Welcome-brightgreen.svg)](CONTRIBUTING.md)\n[![email me](https://img.shields.io/badge/Contact-Email-green.svg)](mailto:nareshnavinash@gmail.com)\n\n\n![alt text](selpy/selpy_module.png)\n\n## Installation\n\nAdd this line to your application's requirements.txt file:\n\n```\nselpy==\u003cversion\u003e\n```\n\nAnd then execute:\n\n```\npip3 install -r requirements.txt\n```\n\nOr install it yourself as:\n\n```\npip3 install selpy\n```\n\n## Usage\n\nThis module is built to replace the library methods in [Selpy-Python](https://github.com/nareshnavinash/Selpy-Python/) framework. This allows us to share the methods among different teams and completely ignore the repetitive work. For more details on Page object model for functional UI automation verify [Selpu Python Documentation](https://nareshnavinash.github.io/Selpy-Python/) page.\n\n### Adding new methods\n\nAdd all the new methods inside `/selpy/` path and add import the class inside `__init__.py` file in the same path so that the newly added class can be imported by using this module.\n\n### Require and Include\n\nTo import this module use,\n```\nimport selpy\n```\nTo import specific class in this module use,\n```\nfrom selpy.driver import Driver\n```\n\n## Detailing the module\n\n### Driver\n\nDriver file holds all the common actions that are executed by the driver. Initiate the driver by,\n```\ndriver = Driver()\n```\nThe `driver` will hold the selenium webdriver object.\n\nFor configuring the driver capabilities, one has to specify the details in the global_data.yml in [Selpy-Python](https://github.com/nareshnavinash/Selpy-Python/).\n\n### Locator\n\nThis class is to declare the selenium locators in Page Object Model. You can declare the locators as follows,\n\n```\nclass AmazonHomePageLocator:\n    # Static locators\n    amazon_logo = Locator(\"css selector\", \"div#nav-logo a[aria-label='Amazon']\")\n    amazon_search_categories = Locator(\"css selector\", \"div.nav-search-scope select.nav-search-dropdown\")\n\n    def __init__(self):\n        print(\"Locators for Amazon home page\")\n    \n    # Dynamic locators\n    @staticmethod\n    def amazon_search_category_list(string):\n        return Locator(\"xpath\", \"//select[contains(@class,'nav-search-dropdown')]//option[text()='%s']\" % string)\n```\n\nTo use the Locator method we need to pass the type of locator and the actual locator element. Type of locator has to be mentioned in the following way to allow `selpy` to process the locator.\n\n```\nCSS - 'css selector'\nXPATH - 'xpath'\nID - 'id'\nNAME - 'name'\nLINK TEXT - 'link text'\nPARTIAL LINK TEXT - 'partial link text'\nTAG NAME - 'tag name'\nCLASS NAME - 'class name'\n``` \n\n### Store\n\nThis class is to store the run time configurations for this module. Kind of a memcached or redis for our framework. Centralized run time data which are needed by other modules are being stored here and retrived by other modules.\n\n### Variable\n\nThis is where the actual snap feature logic is present. In order to save the UI data in to the dynamic file one has to run the tests with,\n\n```\nsnap=1 pytest\n``` \nBut, only this will not ensure the data is getting saved in to dynamic file. One has to script their automation code in such a way that snap feature is supported. For example one can look in to [Selpy-Python](https://github.com/nareshnavinash/Selpy-Python/) framework inside `Tests/amazon.py`\n\nUpon running the tests in normal mode `pytest` the dynamic data will not be overridden rather it will assert the data present in UI with the dynamic data file.\n\nTo get this feature running smoothly and to access the variables in smoother way, one has to configure the following params in their framework in `pytest_configure` method (so that these path variables will be set on initiating the pytest).\n\n```\nfrom selpy.store import Store\n\ndef pytest_configure(config):\n    # Configuring the selpy with data path location\n    Store.global_data_path = os.path.dirname(os.path.abspath(__file__)).replace(\"/Tests\", \"\") + '/Data/GlobalData/global_data.yml'\n    Store.static_data_path = os.path.dirname(os.path.abspath(__file__)).replace(\"/Tests\", \"\") + '/Data/TestData/'\n    Store.dynamic_data_path = os.path.dirname(os.path.abspath(__file__)).replace(\"/Tests\", \"\") + '/Data/DynamicData/'\n``` \n\n## To publish a module in pypi\n\n1. Install the following dependencies\n```\npython3 -m pip install --user --upgrade setuptools wheel\n```\n2. In the root directory of your newly created module run,\n```\npython3 setup.py sdist bdist_wheel\n```\n3. Then add the username and password and upload to the pypi server,\n```\npython3 -m twine upload -u \u003cusername\u003e -p \u003cpassword\u003e --repository-url https://upload.pypi.org/legacy/ dist/* --verbose\n```\nEnsure that you have deleted the old files from your dist directory.\n\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/nareshnavinash/selpy/. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## Authors\n\n* **[Naresh Sekar](https://github.com/nareshnavinash)**\n\n## License\n\nThe gem is available as open source under the terms of the [GPL-3.0 License](https://opensource.org/licenses/GPL-3.0).\n\n## Code of Conduct\n\nEveryone interacting in the Teber project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/nareshnavinash/Teber-Gem/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnareshnavinash%2Fselpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnareshnavinash%2Fselpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnareshnavinash%2Fselpy/lists"}