JSPM

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

Playwright utilities for testing and automation

Package Exports

  • @probolabs/playwright

Readme

Probolib: drive your playwright scripts with AI superpowers

Probolib is a powerful AI-driven automation library that enhances Playwright testing and automation by making your scripts more robust and maintainable. Instead of relying on brittle CSS selectors or complex XPath expressions, Probolib uses natural language to interact with web elements.

Why Probolib?

  • Natural Language Automation: Write human-readable instructions instead of complex selectors
  • More Resilient Tests: AI-powered element detection that adapts to UI changes
  • Simpler Maintenance: Reduce the need to update selectors when the UI changes
  • Faster Development: Write automation scripts in plain English

Example

Instead of writing:

page.click('some > super > complex > css > and non robust selector')

You can simply write:

probo.runStep(page, 'click on the save button')

Quickstart

npm install @probolabs/playwright

Accessing our backend

the heavy lifting of the AI reasoning is done at the moment on our backend server. in order to access it you would need to tell the library how to access it.

easyiest - set ENV var

probolib expects the existance of 2 env vars:

export PROBO_API_ENDPOINT=api.probolabs.ai
export PROBO_API_KEY=<api key we will give you>

Or use dotenv

// npm install dotenv
// in your script add this line
import 'dotenv/config' // ES6

// .env file located in the root of your project (the same level as your package.json)
PROBO_API_ENDPOINT=https://api.probolabs.ai
PROBO_API_KEY=<api key we will give you>

A complete example for Playwright integration. step by step

step 1: init a playwright project

# from your work directory
mkdir probo-example
cd probo-example
npm init playwright@latest
# follow the instructions and wait till the installation is finished
# verify that playwright is installed properly
npx playwright test --project chromium

step 2: integrate probolabs

npm install @probolabs/playwright dotenv

step 3: configure the env with our endpoint and api key

touch .env

edit the .env file

#.env
PROBO_API_ENDPOINT=https://api.probolabs.ai
PROBO_API_KEY=<api key we will give you>

step 4: create a file under the tests folder named probo-example-todo-mvc.spec.mjs

// tests/probo-example-todo-mvc.spec.mjs
import 'dotenv/config';
import { test} from '@playwright/test';
import { Probo } from '@probolabs/playwright';

//
// Important: Before running this script set PROBO_API_KEY and PROBO_API_ENDPOINT
//

test.describe('Todo MVC', () => {
  test('basic example', async ({ page }) => {
    try {
      // Initialize Probo
      const probo = new Probo({
        scenarioName: 'probo-example-todo-mvc' // important for caching the AI reasoning
      });

      //Goto page
      await page.goto('https://demo.playwright.dev/todomvc');

      // Run test steps
      console.log('Running test steps...');
      await probo.runStep(page, 'enter a new todo item: "Buy groceries"');
      await probo.runStep(page, 'press the Enter key');

      console.log('✨ Test completed successfully!');
    } catch (error) {
      console.error('❌ Test failed:', error);
      throw error; // Re-throw to mark the test as failed
    }
  });
});

run the example

npx playwright test tests/probo-example-todo-mvc.spec.mjs --headed --project chromium