npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

locatai-ts

v0.1.0

Published

Enterprise-grade AI-powered element locator for Selenium WebDriver - TypeScript implementation

Readme

LocatAI TypeScript

npm version License: MIT

AI-powered element locator for Selenium WebDriver in TypeScript. LocatAI allows you to find web elements using natural language descriptions instead of manually creating complex CSS or XPath selectors.

Features

  • 🧠 AI-Powered Location: Use natural language to describe elements instead of writing complex selectors
  • 🔀 Multiple AI Providers: Support for OpenAI, Anthropic (Claude), Google Gemini, and Ollama
  • 🔄 Smart Retry Logic: Automatically tries multiple locator strategies with confidence scoring
  • 💾 Caching: Stores successful locators to speed up repeat lookups
  • 📊 Statistics: Tracks locator success rates and timing information
  • ⏱️ Smart Waits: Learns how long elements typically take to appear

Installation

npm install locatai-ts

Usage

Basic Example

import { Builder, WebDriver } from 'selenium-webdriver';
import { ElementFinder, AIProviderFactory } from 'locatai-ts';

async function example() {
  // Initialize WebDriver
  const driver = await new Builder().forBrowser('chrome').build();
  
  try {
    // Go to a website
    await driver.get('https://example.com');
    
    // Initialize LocatAI with your preferred AI provider
    const provider = AIProviderFactory.create();
    ElementFinder.initialize(provider);
    
    // Create an instance of ElementFinder
    const finder = new ElementFinder();
    
    // Find elements using natural language descriptions
    const loginButton = await finder.findElementByLocatAI(driver, 'the login button');
    await loginButton.click();
    
    // Find more elements
    const emailField = await finder.findElementByLocatAI(driver, 'email input field');
    await emailField.sendKeys('[email protected]');
    
    // Use with complex descriptions
    const submitButton = await finder.findElementByLocatAI(
      driver, 
      'the blue submit button at the bottom of the form'
    );
    await submitButton.click();
    
  } finally {
    await driver.quit();
  }
}

Configuration

LocatAI can be configured with various options:

import { ElementFinder, AIProviderFactory, LocatAIOptions } from 'locatai-ts';

// Configure LocatAI with custom options
const options: LocatAIOptions = {
  minimumConfidence: 0.7,       // Minimum confidence threshold (0-1)
  maxLocatorsToTry: 5,          // Number of locators to try before giving up
  timeoutMilliseconds: 5000,    // Timeout for finding elements
  enableDetailedLog: true,      // Enable detailed logging
  enableLocatorRetry: true,     // Enable retry logic
  maxRetryAttempts: 3           // Maximum retry attempts
};

// Initialize with options
const provider = AIProviderFactory.create();
ElementFinder.initialize(provider, options);

Using Different AI Providers

LocatAI supports multiple AI providers:

OpenAI (default)

// Set in environment variables:
// API_KEY=your-openai-api-key
// MODEL=gpt-4-turbo-preview (optional)

// Or in appsettings.json:
// {
//   "provider": "openai",
//   "apiKey": "your-api-key",
//   "modelName": "gpt-4-turbo-preview"
// }

Claude by Anthropic

// Set in environment variables:
// LLMAI_PROVIDER=anthropic
// LLMAI_KEY=your-anthropic-api-key
// LLMAI_MODEL=claude-3-opus-20240229 (optional)

// Or directly:
import { AnthropicProvider, ElementFinder } from 'locatai-ts';

const provider = new AnthropicProvider({
  apiKey: 'your-api-key',
  model: 'claude-3-opus-20240229'
});
ElementFinder.initialize(provider);

Google Gemini

// Set in environment variables:
// LLMAI_PROVIDER=gemini
// LLMAI_KEY=your-gemini-api-key
// LLMAI_MODEL=gemini-2.0-flash (optional)

Ollama (local models)

// Set in environment variables:
// LLMAI_PROVIDER=ollama
// LLMAI_KEY=http://localhost:11434 (optional - default URL)
// LLMAI_MODEL=llama2:latest (optional - specify model name)

License

MIT