JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 830
  • Score
    100M100P100Q93269F
  • License MIT

Autonomous AI coding agent — explores your codebase, diagnoses root causes, writes fixes, and runs tests. Supports Claude, Gemini, DeepSeek, and Kimi K2.

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@spryv/agent) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Nahdi Online Champix Search Automation

    A comprehensive Playwright automation script that searches for 'champix' on nahdionline.com and opens the first result.

    Features

    • Robust Selector Strategy: Multiple fallback selectors for each element
    • Error Handling: Comprehensive error handling with retry mechanisms
    • Popup Management: Automatic handling of cookie banners and age verification
    • Detailed Logging: Timestamped logs with different severity levels
    • Screenshots: Automatic screenshots at key steps and on errors
    • Network Awareness: Waits for network idle state for reliable automation
    • Retry Logic: Configurable retry attempts for flaky scenarios

    Project Structure

    ├── nahdi-champix-automation.js          # Basic automation script
    ├── nahdi-champix-automation-enhanced.js # Enhanced script with full features
    ├── MANUAL_TESTING_GUIDE.md              # Guide for manual testing and selector discovery
    ├── package.json                         # Node.js dependencies
    ├── test-runner.js                       # Test runner with validation
    ├── screenshots/                         # Auto-generated screenshots
    └── README.md                           # This file

    Setup Instructions

    Prerequisites

    • Node.js (v16 or higher)
    • npm or yarn

    Installation

    1. Clone or download this project

    2. Install dependencies

      npm install
    3. Install Playwright browsers

      npm run setup

      Or manually:

      npx playwright install
      npx playwright install-deps

    Usage

    Basic Script

    # Run the basic automation script
    node nahdi-champix-automation.js
    # Run the enhanced script with full features
    node nahdi-champix-automation-enhanced.js

    Test Runner

    # Run with validation and reporting
    node test-runner.js

    Configuration

    Edit the CONFIG object in the enhanced script to customize behavior:

    const CONFIG = {
      headless: false,           // Set to true for headless mode
      timeout: 30000,           // Timeout in milliseconds
      searchTerm: 'champix',    // Search term to use
      screenshotDir: './screenshots',
      waitForNetworkIdle: true, // Wait for network requests to finish
      retryAttempts: 3          // Number of retry attempts
    };

    Manual Testing

    Before running the automation, follow the manual testing guide:

    1. Read MANUAL_TESTING_GUIDE.md
    2. Manually test the website to identify correct selectors
    3. Update the SELECTORS object in the script with accurate selectors
    4. Test the automation script

    Output

    The script generates:

    • Screenshots: Saved in ./screenshots/ directory

      • initial-page-load-[timestamp].png
      • after-search-input-[timestamp].png
      • search-results-page-[timestamp].png
      • product-page-[timestamp].png
      • error-state-[timestamp].png (if errors occur)
    • Logs: Detailed execution logs saved as text files

      • automation-log-[timestamp].txt

    Troubleshooting

    Common Issues

    1. Selectors not found

      • Run manual testing to identify correct selectors
      • Update the SELECTORS object in the script
      • Check if the website structure has changed
    2. Timeout errors

      • Increase the timeout value in CONFIG
      • Check your internet connection
      • Verify the website is accessible
    3. Popup blocking automation

      • Check screenshots to see if popups appeared
      • Update popup selectors in the script
      • Add manual popup handling if needed
    4. Browser launch failures

      • Ensure Playwright browsers are installed: npx playwright install
      • Try running with headless: false to see what's happening
      • Check system requirements for Playwright

    Debug Mode

    To debug issues:

    1. Set headless: false in CONFIG
    2. Add breakpoints or await page.pause() in the script
    3. Check browser developer tools
    4. Review screenshots and logs

    Customization

    Adding New Selectors

    If selectors need updates, modify the SELECTORS object:

    const SELECTORS = {
      search: {
        input: [
          'your-new-selector',
          'input[type="search"]',
          // ... existing selectors
        ]
      }
    };

    Changing Search Term

    Update the CONFIG.searchTerm value:

    const CONFIG = {
      searchTerm: 'your-search-term',
      // ... other config
    };

    Adding New Steps

    Extend the NahdiAutomation class with new methods:

    class NahdiAutomation {
      async yourNewStep() {
        this.log('Performing new step...');
        // Your automation logic here
      }
      
      async run() {
        // ... existing steps
        await this.yourNewStep();
      }
    }

    Browser Support

    This automation is tested with:

    • Chromium (default)
    • Chrome
    • Firefox (may require selector adjustments)
    • Safari (may require selector adjustments)

    Contributing

    To improve this automation:

    1. Test manually using the guide
    2. Update selectors based on findings
    3. Add error handling for new scenarios
    4. Update documentation

    License

    MIT License - feel free to use and modify as needed.