UNPKG

@focusconsulting/auto-a11y

Version:

A powerful tool that combines AI with accessibility-first element selection for Playwright tests

17 lines (16 loc) 789 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const test_1 = require("@playwright/test"); const ollama_locator_1 = require("./ollama-locator"); (0, test_1.test)('use ollama locator to find elements', async ({ page }) => { // Navigate to a page await page.goto('https://example.com'); // Create the Ollama locator const ollamaLocator = (0, ollama_locator_1.createOllamaLocator)(page); // Use the locator to find elements by description const heading = await ollamaLocator.locate('the main heading of the page'); // You can use the returned locator like any other Playwright locator await (0, test_1.expect)(heading).toBeVisible(); const text = await heading.textContent(); console.log('Found heading text:', text); });