Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

AI Authoring Automate Demo Repository for Browserstack

NotificationsYou must be signed in to change notification settings

browserstack/ai-authoring-automate-demo-browserstack

Repository files navigation

TestNG Integration with BrowserStack.

BrowserStack Logo

What Does This Repo Do?

This repository showcases the use ofBrowserStack's Cross-Device Automation Agent for web automation using TestNG and Selenium. The key feature is the ability to write test steps inNatural Language (Plain English), moving away from explicit Selenium locators and actions.

It contains a demo script:

  • BstackAIAuthoring.java: Runs complex test objectives (like selecting a product in a specific price range or navigating to a quote page) using simple English commands.

How It Works

  1. Enablement: The feature is enabled by declaring the capabilityaiAuthoring: true in yourbrowserstack.yml configuration file.
  2. The Command: Inside the test script (BstackAIAuthoring.java), the test uses a standard SeleniumJavascriptExecutor to pass the Natural Language instruction to the BrowserStack environment:
    // Example Objective: Find Google Pixel 3 phone on the website and add 5 of them to the cartjse.executeScript("browserstack_executor: {\"action\":\"ai\",\"arguments\": [\" Click on the Google button and Add 5 Pixel 3 phones to cart\"]}");
  3. Execution: The BrowserStack Cross-Device Automation Agent intercepts this command, interprets the natural language, and executes the equivalent low-level Selenium actions on the target web page.

Running the Tests

Using Maven

Run sample build

  • Clone the repository
  • ReplaceYOUR_USERNAME andYOUR_ACCESS_KEY with your BrowserStack access credentials inbrowserstack.yml.
  • Declare capabilityaiAuthoring: true inbrowserstack.yml file (if not already present).
  • Install dependenciesmvn compile
  • To run the test suite having cross-platform with parallelization, runmvn test -P sample-test.
  • To run local tests, runmvn test -P sample-local-test.

Understand how many parallel sessions you need by using ourParallel Test Calculator.

Integrate your test suite

  • Add maven dependency ofbrowserstack-java-sdk in yourpom.xml file:
    <dependency>    <groupId>com.browserstack</groupId>    <artifactId>browserstack-java-sdk</artifactId>    <version>LATEST</version>    <scope>compile</scope></dependency>
  • Modify your build plugin to run tests by addingargLine -javaagent:${com.browserstack:browserstack-java-sdk:jar} in the Surefire plugin configuration.
  • Install dependenciesmvn compile.

Using Gradle

Prerequisites

  • If using Gradle, Java v9+ is required.

Run sample build

  • Clone the repository
  • Install dependenciesgradle build
  • To run the test suite having cross-platform with parallelization, rungradle sampleTest.
  • To run local tests, rungradle sampleLocalTest.

Integrate your test suite

  • AddcompileOnly 'com.browserstack:browserstack-java-sdk:latest.release' in dependencies in yourgradle.build.
  • Fetch Artifact Information and addjvmArgs property in tasksSampleTest andSampleLocalTest.
  • Install dependenciesgradle build.

Notes

Getting Help

If you are running into any issues or have any queries, please checkBrowserstack Support page orget in touch with us.

About

AI Authoring Automate Demo Repository for Browserstack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp