---
title: Connect Magnitude AI browser automation framework
description: Run Magnitude AI browser automation tests on remote TestingBot browsers.
source_url:
  html: https://testingbot.com/support/ai/integrations/magnitude
  md: https://testingbot.com/support/ai/integrations/magnitude/index.md
---
# Magnitude AI

[Magnitude](https://github.com/magnitudedev/magnitude) is an AI browser automation framework that allows you to run browser automation scripts using AI models. It uses Vision AI to understand the webpage and interact with it, making it possible to automate tasks that require visual understanding.

You can use the framework to automate tasks on webpages, test functionality, extract data and verify any specific behavior on the webpage, just like a normal user would do.

## Running Magnitude AI tests on TestingBot

To run Magnitude AI tests on TestingBot, you can use the following steps and example code to get started:

- `npx create-magnitude-app`
- Next, modify the `src/index.tsx` file that was generated, add a `browser` option to the `startBrowserAgent` function.

    import { startBrowserAgent } from "magnitude-core";
    import z from 'zod';
    import dotenv from 'dotenv';
    
    dotenv.config();
    
    const capabilities = {
        'tb:options': {
            key: process.env.TESTINGBOT_KEY,
            secret: process.env.TESTINGBOT_SECRET,
        },
        browserName: 'chrome',
        browserVersion: 'latest'
    }
    
    async function main() {
        const agent = await startBrowserAgent({
            // Starting URL for agent
            url: 'https://docs.magnitude.run/getting-started/quickstart',
            // Show thoughts and actions
            narrate: true,
            browser: {
                cdp: `wss://cloud.testingbot.com/puppeteer?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`
            }
        });
    
        // Intelligently extract data based on the DOM content matching a provided zod schema
        const gettingStarted = await agent.extract('Extract how to get started with Magnitude', z.object({
            // Agent can extract existing data or new insights
            difficulty: z.enum(['easy', 'medium', 'hard']),
            steps: z.array(z.string()),
        }));
    
        // Navigate to a new URL
        await agent.nav('https://magnitasks.com');
    
        // Magnitude can handle high-level tasks
        await agent.act('Create a task', {
            // Optionally pass data that the agent will use where appropriate
            data: {
                title: 'Get started with Magnitude',
                description: gettingStarted.steps.map(step => `• ${step}`).join('\n')
            }
        });
    
        // It can also handle low-level actions
        await agent.act('Drag "Get started with Magnitude" to the top of the in progress column');
    
        // Stop agent and browser
        await agent.stop();
    }
    
    main();

When you run this example, the Magnitude AI agent will use a remote TestingBot browser to interact with. Results will appear on your machine.

### Looking for more help?

Have questions or need more information? Reach out via email or Slack.

[Email us](https://testingbot.com/contact/new)[Slack Join our Slack](https://join.slack.com/t/testingb0t/shared_invite/zt-3bcw9xch-jk19~6XPs_xBrsAgAedkCw)
