---
title: Selenium and Generative AI | Testing Resources
description: How to use generative AI to produce realistic test data for Selenium
  runs, and why varied data uncovers bugs that fixed fixtures never will.
source_url:
  html: https://testingbot.com/resources/articles/generative-ai-selenium
  md: https://testingbot.com/resources/articles/generative-ai-selenium.md
---

![Selenium and Generative AI](https://testingbot.com/assets/resources/articles/28.webp)

# Generative AI and Automated Testing

How to use generative AI to produce realistic test data for Selenium runs, and why varied data uncovers bugs that fixed fixtures never will.

By [Jochen D.](https://testingbot.com/about/jochen-d)2023-08-06Updated 2026-09-01

 Share on Facebook 

 Share on Twitter 

 Post on Reddit 

 Share link 

The world of software development is evolving and automated testing has become an integral part of delivering high quality software. In order to achieve more efficient testing processes, the importance of test data cannot be overstated.

Having diverse and realistic test data is crucial, for uncovering bugs, validating functionality and ensuring quality of the website or app you are testing.

This is where Generative AI comes in. Generative AI is a groundbreaking technology that revolutionizes how we generate test data, for example for [Selenium](https://testingbot.com/support/web-automate/selenium) or [Appium](https://testingbot.com/support/app-automate/appium)-based automated tests.

In this article we will delve into the power of Generative AI, its role in Selenium & Appium testing and the advantages it brings.

## Table of Contents

- [Why use Generative AI for Test Data generation?](https://testingbot.com#why)
- [Selenium and Generative AI](https://testingbot.com#selenium)

## Why use Generative AI for Test Data generation?

Generative AI, which is a subset of artificial intelligence (AI), gives machines the ability to fabricate data that looks like real-world data. By analyzing patterns in existing datasets, Generative AI algorithms generate data points that maintain the underlying characteristics of the original dataset. Because of these capabilities, Generative AI can create diverse and realistic data sets, which covers a wide range of scenarios and edge cases that are difficult to replicate manually.

## Selenium and Generative AI

While Selenium excels at emulating user interactions, it often relies on predefined datasets for testing. This means it might not fully capture the complexity of real-world scenarios, for example with testing payment methods such as credit cards, or filling in user credentials such as a street address.

Generative Artificial Intelligence, or Generative AI, can help with generating random but valid looking data to be used in your automated Selenium tests.

One popular solution to generate fake test data is to use a library called [Faker](https://github.com/faker-js/faker), which generates realistic data for tests.

To use generative AI with your tests, you can use various libraries in your test automation code. Below are some examples:

These are general-purpose model SDKs being used for test data. For tooling built specifically for testing, see our roundup of [AI testing tools](https://testingbot.com/resources/articles/top-15-ai-testing-tools).

### IBM Generative AI SDK

> The IBM Generative AI Node SDK has not had an npm release since 3.2.4 in November 2024, so treat the example below as illustrative of the pattern rather than a current recommendation. The two SDKs further down this page are both actively maintained. Checked 31 August 2026.

Using [IBM Generative AI SDK](https://github.com/IBM/ibm-generative-ai-node-sdk), you can generate fake data by providing a prompt to the SDK, for example:

```javascript
const address = await model.call(
  'Generate a valid address for a house located in California, United States',
)
// next, use the 'address' in your test automation code to for example fill in a form
```

### Google AI Generative Language

Another popular solution, from Google, is [@google-ai/generativelanguage](https://github.com/googleapis/google-cloud-node) (now part of Google's Gemini API line; the package is still actively maintained, 4.0.0 as of August 2026). You can generate valid looking test data, such as a firstName and lastName with this SDK:

```javascript
const { TextServiceClient } =
  require("@google-ai/generativelanguage").v1beta2;

const { GoogleAuth } = require("google-auth-library");

const MODEL_NAME = "models/text-bison-001";
const API_KEY = process.env.API_KEY;

const client = new TextServiceClient({
  authClient: new GoogleAuth().fromAPIKey(API_KEY),
});

function getUserDetails() {
	return new Promise((resolve) => {
		const prompt = "Generate a first name and a last name for a person living in Canada";

		client
		  .generateText({
		    model: MODEL_NAME,
		    prompt: {
		      text: prompt,
		    },
		  })
		  .then((result) => {
		    const { firstName, lastName } = result.split(' ')
		    resolve({
		    	firstName,
		    	lastName
		    })
		  });
		}
	})
}


const webdriver = require('selenium-webdriver');
const capabilities = {
 'platform' : 'WIN10',
 'browserName' : 'chrome',
 'version' : 'latest',
 'name': 'NodeJS Sample Test'
}
async function runTest () {
  const { firstName, lastName } = await getUserDetails() // fetch new fake generative AI test data
  let driver = new webdriver.Builder()
    .usingServer('https://hub.testingbot.com/wd/hub')
    .withCapabilities(capabilities)
    .build();
  await driver.get("https://www.google.com/ncr");
  const inputField = await driver.findElement(webdriver.By.name("q"));
  // Search google with the generate firstName and lastName
  await inputField.sendKeys(firstName + ' ' + lastName, webdriver.Key.ENTER);
  await driver.quit();
}
runTest();
```

The example above will start a new Selenium test session on TestingBot, navigate to Google, and enter a name generated by Google AI's Generative Language in the Google search input box. The test will then quit (close the browser).

### Generate testdata with intellinode

This NodeJS SDK allows you to use various AI models, such as OpenAI, Cohere, LLaMa v2, Google PaLM, and others. For example, to use with OpenAI's ChatGPT, you can use the example below, after installing intellinode with `npm i intellinode`:

```javascript
const { Chatbot, ChatGPTInput } = require('intellinode');

// set the api key for OpenAI
const chatbot = new Chatbot(apiKey);

const input = new ChatGPTInput('You are helping with creating valid looking data');
input.addUserMessage('Generate a realistic looking name and home address for a person living in the US');

const testdata = await chatbot.chat(input);
let driver = new webdriver.Builder()
    .usingServer('https://hub.testingbot.com/wd/hub')
    .withCapabilities(capabilities)
    .build();
  await driver.get("https://www.google.com/ncr");
  const inputField = await driver.findElement(webdriver.By.name("q"));
  // Search google with the generate firstName and lastName
  await inputField.sendKeys(testData, webdriver.Key.ENTER);
  await driver.quit();
```

The example above starts a Selenium session and enters data generated with ChatGPT, using a prompt that asks the Chatbot to create realistic looking test data.

The synergy between Generative AI and Selenium Automated Tests is a paradigm shift in software testing. It opens the door to improved testing coverage, enhanced accuracy, and faster testing cycles.

Topics [Selenium](https://testingbot.com/resources/articles/topic/selenium) [AI Testing](https://testingbot.com/resources/articles/topic/ai-testing) 

## Sidebar

### TestingBot Cloud Testing

Run automated, manual and visual tests on remote browsers and devices. Sign up for a free trial.

[Free Trial](https://testingbot.com/users/sign_up)

### Latest articles

[![AI in Software Testing: What Works](https://testingbot.com/assets/resources/articles/ai-in-software-testing-ab8885a15af9f64731cdb97574153660eb0f409067995f0a089094cac76431e2.webp)](https://testingbot.com/resources/articles/ai-in-software-testing)

#### [AI in Software Testing: What Works](https://testingbot.com/resources/articles/ai-in-software-testing)

A category-by-category look at where AI genuinely helps a...

[Read article →](https://testingbot.com/resources/articles/ai-in-software-testing)

[![Playwright MCP for Test Automation](https://testingbot.com/assets/resources/articles/playwright-mcp-da3126b2a5a5b0fe528ad6311ccb79e7a2943f7a3b637a5ae5e748087a59f39a.webp)](https://testingbot.com/resources/articles/playwright-mcp)

#### [Playwright MCP for Test Automation](https://testingbot.com/resources/articles/playwright-mcp)

What Playwright MCP does, how driving the accessibility t...

[Read article →](https://testingbot.com/resources/articles/playwright-mcp)

[![Selenium Python Tutorial](https://testingbot.com/assets/resources/articles/51-39337d128e18d16ddec5fe39124c2302f334e0f21e06f361cfd19e0b719e8861.webp)](https://testingbot.com/resources/articles/python-selenium-web-automation-test)

#### [Selenium Python Tutorial](https://testingbot.com/resources/articles/python-selenium-web-automation-test)

Getting started with Selenium WebDriver in Python: a firs...

[Read article →](https://testingbot.com/resources/articles/python-selenium-web-automation-test)

## Other Articles

[![15 Best AI Testing Tools in 2026](https://testingbot.com/assets/resources/articles/44-0566068e7f37e24257a058aa6ff3398f11e192e89be40e10d2e8a81335d16b6c.webp)](https://testingbot.com/resources/articles/top-15-ai-testing-tools "15 Best AI Testing Tools in 2026")

### [15 Best AI Testing Tools in 2026](https://testingbot.com/resources/articles/top-15-ai-testing-tools)

A reviewed list of 15 AI-driven testing tools for web and mobile: what each one actually automates, and where it fits alongside a normal test suite.

[Read article →](https://testingbot.com/resources/articles/top-15-ai-testing-tools)

[![Handling Exceptions with Selenium Webdriver](https://testingbot.com/assets/resources/articles/43-044fb4e2070e941fec050b38f1c4ed34a06e7c8b63c67a6b8758805869eb75be.webp)](https://testingbot.com/resources/articles/exception-handling-with-selenium "Handling Exceptions with Selenium Webdriver")

### [Handling Exceptions with Selenium Webdriver](https://testingbot.com/resources/articles/exception-handling-with-selenium)

The Selenium WebDriver exceptions you will actually hit, from NoSuchElement to StaleElementReference, what triggers each and how to prevent them.

[Read article →](https://testingbot.com/resources/articles/exception-handling-with-selenium)

[![ElementClickInterceptedException in Selenium](https://testingbot.com/assets/resources/articles/33-47ac7bd953d8c5e5d1274bfe324e755e37c21003cf9224b826e4833a9f1e9001.webp)](https://testingbot.com/resources/articles/selenium-elementclickinterceptedexception "ElementClickInterceptedException in Selenium")

### [ElementClickInterceptedException in Selenium](https://testingbot.com/resources/articles/selenium-elementclickinterceptedexception)

What causes an ElementClickInterceptedException in Selenium, how it differs from the other click failures, and how to handle it reliably.

[Read article →](https://testingbot.com/resources/articles/selenium-elementclickinterceptedexception)

[![Testing with React and Selenium](https://testingbot.com/assets/resources/articles/31-744de7cfd83a956722f63fdccfc836d4cd8ee5182785fd84f7bbabe3a40e1615.webp)](https://testingbot.com/resources/articles/react-selenium-testing "Testing with React and Selenium")

### [Testing with React and Selenium](https://testingbot.com/resources/articles/react-selenium-testing)

How to test a React site with both React Testing Library and Selenium WebDriver, and when each of the two is the right tool to reach for.

[Read article →](https://testingbot.com/resources/articles/react-selenium-testing)

## Ready to start testing?
[Start a free trial](https://testingbot.com/users/sign_up)
