{"id":16556305,"url":"https://github.com/antonyhaman/podegen","last_synced_at":"2026-04-20T04:35:59.322Z","repository":{"id":211428089,"uuid":"729100177","full_name":"antonyhaman/podegen","owner":"antonyhaman","description":"Page Object code generation for Selenium and Selenide in Java","archived":false,"fork":false,"pushed_at":"2024-02-14T14:24:47.000Z","size":132,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T22:20:20.016Z","etag":null,"topics":["codegeneration","java","pagefactory","pageobject","pageobject-pattern","selenide","selenium"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antonyhaman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-08T12:13:49.000Z","updated_at":"2024-01-15T10:12:40.000Z","dependencies_parsed_at":"2024-01-16T18:04:39.155Z","dependency_job_id":"b645197f-1c5f-46e2-a33b-54578d68a1f1","html_url":"https://github.com/antonyhaman/podegen","commit_stats":null,"previous_names":["kotvertolet/podegen","antonyhaman/podegen"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/antonyhaman/podegen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyhaman%2Fpodegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyhaman%2Fpodegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyhaman%2Fpodegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyhaman%2Fpodegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonyhaman","download_url":"https://codeload.github.com/antonyhaman/podegen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyhaman%2Fpodegen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32032840,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"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":["codegeneration","java","pagefactory","pageobject","pageobject-pattern","selenide","selenium"],"created_at":"2024-10-11T20:04:08.703Z","updated_at":"2026-04-20T04:35:59.276Z","avatar_url":"https://github.com/antonyhaman.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Maven Central](https://github.com/antonyhaman/podegen/actions/workflows/maven-publish.yml/badge.svg)](https://github.com/antonyhaman/podegen/actions/workflows/maven-publish.yml) ![Static Badge](https://img.shields.io/badge/license-Apache%202.0-green)   ![Static Badge](https://img.shields.io/badge/Java-17-green) \n\n\n# Podegen - Page Object Code Generation for Selenium and Selenide in Java\n\nPodegen is a Java library for generating page object classes from yaml or json template files. \nIt supports both Selenium and Selenide and has two variants of the page object. This is how it works:\n\nTemplate file like this:\n```yaml\n- searchInputField:\n    name: \"q\"\n- submitButton:\n    id: \"search_button\"\n- $$searchResultsList:\n    xpath: \"//section/ol[@class='react-results--main']/li\"\n```\nCreates the following page object class:\n\n```java\npublic class SearchResultsPage {\n  @FindBy(\n      name = \"q\"\n  )\n  protected SelenideElement searchInputField;\n\n  @FindBy(\n      id = \"search_button\"\n  )\n  protected SelenideElement submitButton;\n\n  @FindBy(\n      xpath = \"//section/ol[@class='react-results--main']/li[@data-layout='organic']\"\n  )\n  protected ElementsCollection searchResultsList;\n\n  public static SearchResultsPage getPage() {\n    return com.codeborne.selenide.Selenide.page(SearchResultsPage.class);\n  }\n\n  public SelenideElement getSearchInputField() {\n    return searchInputField;\n  }\n\n  public SelenideElement getSubmitButton() {\n    return submitButton;\n  }\n\n  public ElementsCollection getSearchResultsList() {\n    return searchResultsList;\n  }\n}\n\n\n```\n\u003cdetails\u003e\n  \u003csummary\u003eOr if you don't like Page Factory approach...\u003c/summary\u003e\n  ...you can also enjoy 'classic' Page Object: \n\n```java\npublic class SearchResultsPage {\n  protected By searchInputField = By.name(\"q\");\n\n  protected By submitButton = By.id(\"search_button\");\n\n  protected By searchResultsList = By.xpath(\"//section/ol[@class='react-results--main']/li\");\n\n  protected WebDriver driver;\n\n  public SearchResultsPage(WebDriver driver) {\n    this.driver = driver;\n  }\n\n  public WebElement getSearchInputField() {\n    return driver.findElement(searchInputField);\n  }\n\n  public WebElement getSubmitButton() {\n    return driver.findElement(submitButton);\n  }\n\n  public List\u003cWebElement\u003e getSearchResultsList() {\n    return driver.findElements(searchResultsList);\n  }\n}\n```\n\u003c/details\u003e\n\n## How to install?\n\nAdd the following dependency into your POM.xml:\n```xml\n\u003cdependency\u003e\n   \u003cgroupId\u003eio.github.antonyhaman\u003c/groupId\u003e\n   \u003cartifactId\u003epodegen-core\u003c/artifactId\u003e\n   \u003cversion\u003e1.1.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nAlso, it's recommended to add the following maven plugin into your `\u003cbuild\u003e` section:\n```xml\n\u003cplugins\u003e\n    \u003cplugin\u003e\n        \u003cgroupId\u003eorg.codehaus.mojo\u003c/groupId\u003e\n        \u003cartifactId\u003ebuild-helper-maven-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e3.0.0\u003c/version\u003e\n        \u003cexecutions\u003e\n            \u003cexecution\u003e\n                \u003cid\u003eadd-source\u003c/id\u003e\n                \u003cphase\u003egenerate-sources\u003c/phase\u003e\n                \u003cgoals\u003e\n                    \u003cgoal\u003eadd-source\u003c/goal\u003e\n                \u003c/goals\u003e\n                \u003cconfiguration\u003e\n                    \u003csources\u003e\n                        \u003csource\u003e${basedir}/target/generated-test-sources/test-annotations/\u003c/source\u003e\n                    \u003c/sources\u003e\n                \u003c/configuration\u003e\n            \u003c/execution\u003e\n        \u003c/executions\u003e\n    \u003c/plugin\u003e\n\u003c/plugins\u003e\n```\n\n## How to use?\n\n1. Add the `@PageObject` annotation to your configuration class (usually a class called BaseTest or something similar). \nThe `@PageObject` annotation has 4 optional parameters:\n  \t- **flavour** - `Selenium` (by default) or `Selenide`\n  \t- **strategy** - `Page Factory` (by default) or `Page Object`\n  \t- **prefix** - prefix for template files, if not specified, Podegen will process all json and yaml files (not recommended)\n  \t- **packages** - packages in which the classes for the page objects should be generated, e.g. `packages=\"com.example.somePackage\"`,\n      if empty, Podegen will use the packages of a class provided with the `@PageObject` annotation. \n      Note that the actual classes are generated in `target/test-annotations` in any case, but the classes have the package you specify,\n      so you can import them into your classes as if it were a class in your project.\n\n```java\n@PageObject(flavour = Flavours.Selenide, strategy = Strategies.PageFactory, prefix = \"PO_\", packages = \"com.example.test\")\n```\n\n2. Put page object template files into `resources` folder of the same source root as the class annotated with `@PageObject`, for example, if the class annotated with `@PageObject` is located in the `src/main` directory, then the page object template files should be placed in the `src/main/resources` directory. Page object template files should be in the following format:\n\n  \u003cdetails\u003e\n     \u003csummary\u003eYaml\u003c/summary\u003e\n  \n   ```yaml\n         - elementName:\n           locatorType: \"locator\"\t\t\n   ```\n  \n  \u003c/details\u003e\n\n  \u003cdetails\u003e\n     \u003csummary\u003eJson\u003c/summary\u003e\n  \n  ```json\n      [\n        {\n          \"elementName\": {\n             \"locatorType\": \"locator\"\n           }\n         }\n       ]\n  ```\n   \u003c/details\u003e\n\nWhere:\n   - `elementName` would be used as the field name for the `WebElement`/`SelenideElement` (for Selenium and Selenide flavour accordingly) \nor if you add `$$` as a prefix to the element name, it will be `List\u003cWebElement\u003e`/`ElementsCollection`\n   - `locatorType` can be one of the locator types supported by Selenium (id, name, css, xpath, etc.)\n   - `locator` is the locator itself.\n\n3. Enable annotation processing in your IDE:\n\n    #### Intellij Idea\n      Press Ctrl + Alt + S to open the IDE settings and then select Build, Execution, Deployment | Compiler | Annotation Processors and then tick 'Enable annotation processing' checkbox\n\n    #### Eclipse\n     [Please refer to this guide](https://shorturl.at/goEJ9)\n   \n4. Now you can build your project and find your generated page object classes in `target -\u003e generated-test-sources -\u003e test-annotations`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonyhaman%2Fpodegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonyhaman%2Fpodegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonyhaman%2Fpodegen/lists"}