LocatAI 1.2.0-beta

This is a prerelease version of LocatAI.
There is a newer version of this package available.
See the version list below for details.
dotnet add package LocatAI --version 1.2.0-beta
                    
NuGet\Install-Package LocatAI -Version 1.2.0-beta
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LocatAI" Version="1.2.0-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LocatAI" Version="1.2.0-beta" />
                    
Directory.Packages.props
<PackageReference Include="LocatAI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LocatAI --version 1.2.0-beta
                    
#r "nuget: LocatAI, 1.2.0-beta"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=LocatAI&version=1.2.0-beta&prerelease
                    
Install LocatAI as a Cake Addin
#tool nuget:?package=LocatAI&version=1.2.0-beta&prerelease
                    
Install LocatAI as a Cake Tool

LocatAI

LocatAI is an AI-powered element locator for Selenium WebDriver automation. It helps you find elements on web pages using natural language descriptions instead of brittle CSS/XPath selectors.

Features

  • Natural Language Locators: Find elements using plain English descriptions
  • Multiple AI Providers: Support for OpenAI, Anthropic Claude, Google Gemini, and Ollama
  • Smart Caching: Reduce API calls and improve performance
  • Confidence Scoring: Each locator comes with a confidence score
  • Automatic Retry: Configurable retry mechanism for failed locators
  • WebDriver Extension Methods: Simple integration with Selenium WebDriver

Installation

dotnet add package LocatAI

Quick Start

Step 1: Add an appsettings.json file to your project

{
  "AI": {
    "Provider": "openai",
    "ApiKey": "your-api-key-here",
    "Model": "gpt-4"
  },
  "Options": {
    "MinimumConfidence": 0.4,
    "MaxLocatorsToTry": 3,
    "EnableDetailedLogging": true,
    "TimeoutMilliseconds": 10000,
    "EnableLocatorRetry": true,
    "MaxRetryAttempts": 1
  }
}

Don't forget to set the Copy to Output Directory property to Copy if newer in your project settings.

Step 2: Initialize with the configuration

using Microsoft.Extensions.Configuration;
using LocatAI.Core;

// Load configuration from appsettings.json
var config = new ConfigurationBuilder()
    .SetBasePath(AppContext.BaseDirectory)
    .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
    .Build();

// Initialize LocatAI with the configuration
ElementFinder.Initialize(config);

Step 3: Use in your tests

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using LocatAI.Core;

// Create a WebDriver instance
var driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://example.com");

// Find elements using natural language
var loginButton = driver.FindElementByLocatAI("login button");
loginButton.Click();

var usernameField = driver.FindElementByLocatAI("username input field");
usernameField.SendKeys("your-username");

Advanced Configuration

If you need more control, you can also configure LocatAI programmatically:

using LocatAI.Core;
using LocatAI.Providers;
using LocatAI.Models;

// Initialize with a specific provider
var provider = AIProviderFactory.Create("openai", "your-api-key", "gpt-4");
ElementFinder.Initialize(provider);

// Or with custom options
var options = new LocatAIOptions
{
    MinimumConfidence = 0.5,
    MaxLocatorsToTry = 5,
    EnableDetailedLogging = true
};
ElementFinder.Initialize(provider, options);

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.4-beta 39 5/10/2025
1.3.3-beta 112 5/7/2025
1.3.2-beta 110 5/7/2025
1.3.1-beta 121 4/28/2025
1.3.0 129 4/28/2025
1.2.6-beta 123 4/28/2025
1.2.5-beta 124 4/28/2025
1.2.4-beta 122 4/28/2025
1.2.3-beta 122 4/28/2025
1.2.2-beta 130 4/28/2025
1.2.1-beta 101 4/27/2025
1.2.0-beta 100 4/27/2025