generate_java_page_object
Generate a Java Page Object and corresponding test class from a recorded browser session. Creates production‑ready code containing only the elements and actions actually performed, with support for TestNG, JUnit 5, or Selenium Boot.
Instructions
Generate a Java Page Object class + matching test class from the recorded session. USE THIS INSTEAD OF WRITING JAVA BY HAND — the output compiles as-is and contains only the elements/actions actually performed, so it never invents fields or uses non-existent framework APIs. Produces two files: a Page Object (locators + fluent action methods) and a Test class that uses it. Supports raw Selenium (TestNG / JUnit 5) and the Selenium Boot framework (selenium_boot): Page Object extends BasePage, Test extends BaseTest, no manual driver lifecycle — the framework manages it — with accessibility-first locators. For any Java test in a Selenium Boot repo, use framework="selenium_boot".
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| framework | No | Output flavor: 'testng'/'junit5' emit standalone Selenium with a ChromeDriver setUp/tearDown; 'selenium_boot' emits Selenium Boot (BasePage/BaseTest, framework-managed driver, web-first assertions). | testng |
| page_name | No | Name of the page class e.g. LoginPage. Auto-inferred from URL if omitted. | |
| package_name | No | Base package, e.g. com.demo. The Page Object is placed in <base>.pages and the Test in <base>.tests. A trailing .pages or .tests is stripped, so passing either the base or a pages package works. | com.example |