generate_java_page_object
Generate a Java Page Object and matching test class from a recorded browser session, producing compilable code with only real actions and locators. Choose TestFly, TestNG, JUnit5, or Selenium boot output.
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 TestFly (framework='testfly', default): Page Object extends BasePage, Test extends BaseTest, framework manages driver lifecycle, accessibility-first locators and web-first assertThat assertions. framework='testng'/'junit5' emit standalone raw Selenium.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| framework | No | Output flavor: 'testfly' (default) emits TestFly (BasePage/BaseTest, framework-managed driver, web-first assertions); 'testng'/'junit5' emit standalone Selenium with a ChromeDriver setUp/tearDown. | testfly |
| 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 |