Documentation

Complete guide to using Pomgo CLI for test automation

Quick Start

1. Installation

$
npm install -g @pomgodev/cli

Requires Node.js 18+ installed on your system

2. Get Your Token

Request a license token from the Get Started page

# Option 1: Command line
pomgo pick https://example.com --token YOUR_TOKEN
# Option 2: Environment variable (recommended)
echo 'CLI_TOKEN=your_token_here' > .env
pomgo pick https://example.com

3. Start Using

# Pick elements interactively
pomgo pick https://example.com/login

Best Practice Workflow

1

Interactive Picking (Recommended)

For precise control, use the interactive picker to select exactly the elements you need:

pomgo pick https://your-app.com/login
Controls:
  • • Press Ctrl+Shift+X to toggle picking mode
  • • Hover over elements to highlight them
  • • Click to pick an element
  • • Press Ctrl+C to exit

Output: output/picked/picked-elements-latest.json

2

Automatic Parsing (Alternative)

For quick extraction of all interactive elements without manual selection:

pomgo parse https://your-app.com/login

Output: output/your-app.com.json

Note: This extracts all interactive elements automatically, which may include elements you don't need

3

Generate POM with AI (Recommended)

Generate clean, maintainable Page Object Model classes with AI-powered naming and grouping:

# With AI (best results)
pomgo generate --llm
# Or specify the JSON file explicitly
pomgo generate output/picked/picked-elements-latest.json --llm
Why use --llm?
  • ✓ Intelligent element naming (e.g., emailInput instead of input1)
  • ✓ Smart grouping (forms, navigation, actions)
  • ✓ Meaningful action methods (e.g., login() instead of generic methods)
  • ✓ Better code organization and maintainability

Output: output/pom/LoginPage.ts

Note: Requires OPENAI_API_KEY environment variable

Commands Reference

🎯pick

Interactive element picker with visual highlighting

pomgo pick <url> [--token <key>]
Features:
  • Visual element highlighting on hover
  • Click to pick elements and see locators
  • Multiple locator strategies (CSS, XPath, Playwright)
  • Auto-save on every pick

🔍parse

Automatically extract all interactive elements from a page

pomgo parse <url> [--token <key>]
Features:
  • Extracts all interactive elements automatically
  • Multiple locator strategies with confidence scoring
  • Element classification (input, button, link, etc.)

generate

Generate Page Object Model classes from JSON

pomgo generate [file.json] [options] [--token <key>]
Options:
  • --llm - Use AI (GPT-4) for intelligent code generation
  • --framework <fw> - playwright | selenium | cypress (default: playwright)
  • --output <dir> - Output directory (default: output/pom)
  • --merge <file> - Merge new elements into existing POM
  • --no-actions - Don't generate action methods
# Examples:
pomgo generate --llm
pomgo generate file.json --framework selenium
pomgo generate --merge output/pom/LoginPage.ts

Framework Support

Playwright

Default framework

--framework playwright

Selenium

WebDriver support

--framework selenium

Cypress

End-to-end testing

--framework cypress

Tips & Best Practices

1. Use Environment Variables

Store your token in a .env file to avoid passing it with every command:

CLI_TOKEN=your_token_here

2. Always Use --llm for Production Code

AI-powered generation produces cleaner, more maintainable code with better naming conventions

3. Pick Strategically

Use interactive picking for critical user flows to ensure you select only the elements you need

4. Merge Updates Carefully

When updating existing POMs, use --merge to combine new elements with existing ones