{"id":14978891,"url":"https://github.com/saritasa-nest/pomcorn","last_synced_at":"2025-09-03T02:46:46.250Z","repository":{"id":205257438,"uuid":"696827488","full_name":"saritasa-nest/pomcorn","owner":"saritasa-nest","description":"Quick start for perfect tests","archived":false,"fork":false,"pushed_at":"2025-08-18T02:08:38.000Z","size":1035,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-18T04:11:50.906Z","etag":null,"topics":["autotesting","autotests","browser","pageobject","pageobject-pattern","pageobjectmodel","parsing","pom","python","selenium-python","webdriver"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/saritasa-nest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-09-26T14:02:01.000Z","updated_at":"2025-08-18T02:08:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"11ff517d-43e5-45b7-91a1-9f882046e7c2","html_url":"https://github.com/saritasa-nest/pomcorn","commit_stats":null,"previous_names":["saritasa-nest/pomcorn"],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/saritasa-nest/pomcorn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saritasa-nest%2Fpomcorn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saritasa-nest%2Fpomcorn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saritasa-nest%2Fpomcorn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saritasa-nest%2Fpomcorn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saritasa-nest","download_url":"https://codeload.github.com/saritasa-nest/pomcorn/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saritasa-nest%2Fpomcorn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273381915,"owners_count":25095330,"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","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["autotesting","autotests","browser","pageobject","pageobject-pattern","pageobjectmodel","parsing","pom","python","selenium-python","webdriver"],"created_at":"2024-09-24T13:58:35.428Z","updated_at":"2025-09-03T02:46:46.239Z","avatar_url":"https://github.com/saritasa-nest.png","language":"Python","funding_links":[],"categories":["UI Testing"],"sub_categories":[],"readme":"# Pomcorn\n\n![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/saritasa-nest/pomcorn/pre-commit.yml) ![PyPI](https://img.shields.io/pypi/v/pomcorn) ![PyPI - Status](https://img.shields.io/pypi/status/pomcorn) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pomcorn) ![PyPI - License](https://img.shields.io/pypi/l/pomcorn) ![PyPI - Downloads](https://img.shields.io/pypi/dm/pomcorn) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n\n\n**Pomcorn**, or **Page Object Model corn**, is a Python package that contains base classes to create systems based on [Selenium](https://github.com/SeleniumHQ/selenium#selenium) framework and **Page Object Model** pattern. You can read more about this pattern [here](https://www.selenium.dev/documentation/test_practices/encouraged/page_object_models/). The package can be used to create autotesting systems, parsing scripts and anything that requires\ninteraction with the browser.\n\nThe package includes next base classes to create Page Object Model (``POM``) pages:\n\n```mermaid\n  classDiagram\n    WebView \u003c|-- Component\n    WebView \u003c|-- Page\n    Component \u003c|-- ListComponent\n    Component .. Locator\n    Page .. Component\n\n    class WebView{\n        -webdriver: Webdriver\n    }\n    class Page{\n        +wait_until_loaded()\n        +open()\n    }\n    class Component{\n        -page: Page\n        -base_locator: Locator\n        + wait_until_visible()\n    }\n    class ListComponent{\n        -item_locator: Locator\n        +count()\n        +all()\n        +get_item_by_text()\n    }\n    class Locator{\n      -query: String\n    }\n\n```\n\nIt also includes [classes to locate elements](https://pomcorn.readthedocs.io/en/latest/locators.html) on the web page and a number of additional [waiting conditions](https://pomcorn.readthedocs.io/en/latest/waits_conditions.html).\n\n## Installation\n\nYou can install it by **pip**:\n\n```bash\n  pip install pomcorn\n```\n\nOr **poetry**:\n\n```bash\n  poetry add pomcorn\n```\n\n## Documentation\n\nLink to the documentation: [http://pomcorn.rtfd.io/](http://pomcorn.rtfd.io/).\n\n## Usage\n\nYou need to [install pomcorn](https://pomcorn.readthedocs.io/en/latest/installation.html) and [Chrome webdriver](https://pomcorn.readthedocs.io/en/latest/installation.html#chrome-driver).\n\nBelow is the code that opens ``PyPI.org``, searches for packages by name and prints names of found packages to the terminal. The script contains all base classes contained in ``pomcorn``: **Page**, **Component**, **ListComponent** and **Element**.\n\n```python\n\n  from typing import Self\n\n  from selenium.webdriver import Chrome\n  from selenium.webdriver.common.keys import Keys\n  from selenium.webdriver.remote.webdriver import WebDriver\n\n  from pomcorn import Component, Element, ListComponent, Page, locators\n\n\n  # Prepare base page\n  class PyPIPage(Page):\n\n      APP_ROOT = \"https://pypi.org\"\n\n      search = Element(locators.IdLocator(\"search\"))\n\n      def check_page_is_loaded(self) -\u003e bool:\n          return self.init_element(locators.TagNameLocator(\"main\")).is_displayed\n\n\n  # Prepare components\n  Package = Component[PyPIPage]\n\n\n  class PackageList(ListComponent[Package, PyPIPage]):\n\n      relative_item_locator = locators.ClassLocator(\"snippet__name\")\n\n      @property\n      def names(self) -\u003e list[str]:\n          return [package.body.get_text() for package in self.all]\n\n\n  # Prepare search page\n  class SearchPage(PyPIPage):\n\n      @classmethod\n      def open(cls, webdriver: WebDriver, **kwargs) -\u003e Self:\n          pypi_page = super().open(webdriver, **kwargs)\n          # Specific logic for PyPI for an open search page\n          pypi_page.search.fill(\"\")\n          pypi_page.search.send_keys(Keys.ENTER)\n          return cls(webdriver, **kwargs)\n\n      @property\n      def results(self) -\u003e PackageList:\n          return PackageList(\n              page=self,\n              base_locator=locators.PropertyLocator(\n                  prop=\"aria-label\",\n                  value=\"Search results\",\n              ),\n          )\n\n      def find(self, query: str) -\u003e PackageList:\n          self.search.fill(query)\n          self.search.send_keys(Keys.ENTER)\n          return self.results\n\n\n  search_page = SearchPage.open(webdriver=Chrome())\n  print(search_page.find(\"saritasa\").names)\n  search_page.webdriver.close()\n```\n\nFor more information about package classes, you can read in [Object Hierarchy](https://pomcorn.readthedocs.io/en/latest/objects_hierarchy.html) and [Developer Interface](https://pomcorn.readthedocs.io/en/latest/developer_interface.html).\n\nAlso you can try our [demo autotests project](https://pomcorn.readthedocs.io/en/latest/demo.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaritasa-nest%2Fpomcorn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaritasa-nest%2Fpomcorn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaritasa-nest%2Fpomcorn/lists"}