LocatAI 1.3.1-beta
See the version list below for details.
dotnet add package LocatAI --version 1.3.1-beta
NuGet\Install-Package LocatAI -Version 1.3.1-beta
<PackageReference Include="LocatAI" Version="1.3.1-beta" />
<PackageVersion Include="LocatAI" Version="1.3.1-beta" />
<PackageReference Include="LocatAI" />
paket add LocatAI --version 1.3.1-beta
#r "nuget: LocatAI, 1.3.1-beta"
#:package LocatAI@1.3.1-beta
#addin nuget:?package=LocatAI&version=1.3.1-beta&prerelease
#tool nuget:?package=LocatAI&version=1.3.1-beta&prerelease
LocatAI
AI-powered element locator for Selenium WebDriver automation. Supports multiple AI providers including OpenAI, Anthropic, Google Gemini, and Ollama.
Installation
Install the package from NuGet:
dotnet add package LocatAI
Configuration
- Create an
appsettings.json
file in your project with the following structure:
{
"AI": {
"Provider": "openai",
"ApiKey": "your-api-key-here",
"Model": "gpt-4"
},
"Options": {
"MinimumConfidence": 0.65,
"MaxLocatorsToTry": 5,
"TimeoutMilliseconds": 10000,
"EnableDetailedLogging": true,
"EnableLocatorRetry": true,
"MaxRetryAttempts": 2
}
}
Set the "Provider" to one of:
openai
(requires OpenAI API key)anthropic
(requires Anthropic API key)gemini
(requires Google AI Studio API key)ollama
(requires Ollama running locally, set ApiKey to Ollama URL e.g. "http://localhost:11434")
- Initialize LocatAI in your code:
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 ElementFinder with configuration
ElementFinder.Initialize(config);
- Use the extension methods to find elements:
// Basic usage - returns just the IWebElement
IWebElement username = driver.FindElementByLocatAI("username input field");
IWebElement loginButton = driver.FindElementByLocatAI("login button");
// Advanced usage - returns both element and locator details
var (element, locator) = driver.FindElementWithDetailsByLocatAI("submit button");
Console.WriteLine($"Found element using {locator.LocatorType}={locator.LocatorValue} with confidence {locator.Confidence:P}");
// Async versions available
var searchBox = await driver.FindElementByLocatAIAsync("search input box");
var (submitBtn, locatorInfo) = await driver.FindElementWithDetailsByLocatAIAsync("submit or search button");
Features
- Natural language element location using AI
- Multiple AI provider support (OpenAI, Anthropic, Google Gemini, Ollama)
- Smart caching of successful locators
- Automatic retry with fallback strategies
- Detailed logging options
- Configurable confidence thresholds and timeouts
- Both synchronous and asynchronous methods
- Supports all major locator types:
- ID
- Name
- CSS Selector
- XPath
- Class Name
- Tag Name
- Link Text
- Partial Link Text
Advanced Features
Confidence Scores
Each locator comes with a confidence score (0-1) indicating how likely it is to work. Configure minimum confidence with MinimumConfidence
option.
Smart Caching
Successful locators are cached based on URL, element description, and DOM hash. This improves performance on subsequent visits.
Automatic Retry
If enabled with EnableLocatorRetry
, failed locators trigger new AI-generated alternatives up to MaxRetryAttempts
times.
Smart Waits
The system learns optimal wait times based on historical timing data for each element, automatically adjusting implicit waits.
Performance Tracking
Failed locators with low success rates are automatically removed from cache to maintain high reliability.
Dependencies
- Selenium.WebDriver (4.31.0+)
- Microsoft.Extensions.Configuration
- System.Text.Json
- One of the following AI providers:
- OpenAI API key
- Anthropic API key
- Google AI Studio API key
- Local Ollama installation
License
MIT
Product | Versions 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. |
-
.NETStandard 2.0
- Microsoft.Extensions.Configuration (>= 9.0.4)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.4)
- Microsoft.Extensions.Configuration.Json (>= 9.0.4)
- Microsoft.Extensions.Logging (>= 9.0.4)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.4)
- OpenAI (>= 2.2.0-beta.4)
- Selenium.Support (>= 4.31.0)
- Selenium.WebDriver (>= 4.31.0)
- System.Text.Json (>= 9.0.4)
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 | 49 | 5/10/2025 |
1.3.3-beta | 125 | 5/7/2025 |
1.3.2-beta | 121 | 5/7/2025 |
1.3.1-beta | 129 | 4/28/2025 |
1.3.0 | 153 | 4/28/2025 |
1.2.6-beta | 133 | 4/28/2025 |
1.2.5-beta | 133 | 4/28/2025 |
1.2.4-beta | 131 | 4/28/2025 |
1.2.3-beta | 132 | 4/28/2025 |
1.2.2-beta | 140 | 4/28/2025 |
1.2.1-beta | 110 | 4/27/2025 |
1.2.0-beta | 108 | 4/27/2025 |