\n"+o):""}(s,e.version),a}function re(e,t){var n,o,r,i,s,a,l,c,d={};if(!k(e)||!A(e.schema_version)||!u(e.version))return!1;if(null!=t&&e.version!==t)return!1;if(n=e.components,!(k(e.products)&&k(e.links)&&k(n)&&k(n.products_dropdown)))return!1;if(!x(o=n.products_dropdown.tabs)||!o.length)return!1;for(r=0;rSkip to main content
Experience faster, smarter testing with BrowserStack AI Agents. See what your workflowβs been missing. Explore now!
Get your setup working faster. Join our Discord for optimisation tips from elite testers.Join our Discord
Selenium with Java
Your guide to running tests using Java on BrowserStackβs Selenium Grid of 3000+ real devices and desktop browsers.
This section covers running your first build with BrowserStackβs sample repo. To run builds with your existing test suite(s), skip to integrate your test suite.
Onboard faster with Test Companion
Launch in your IDE. Chat with the AI assistant to configure and run your first build instantly.
Launch in IDE
Opening Test Companion in your IDE
Prerequisites
BrowserStack Username and Access key. You can find this in your account profile. If you do not have an account yet, please sign up for a Free Trial.
Maven
JDK 11+, Maven 3.6+, Selenium 4.23+ (W3C).
If you are using CLI for running tests, ensure that Maven is installed on your machine, its environment variables are set, and its bin is added to system path, $PATH.
Gradle
Java v9+
If you are using CLI for running tests, ensure that Gradle is installed on your machine, its environment variables are set, and its bin is added to system path, $PATH.
Run a sample build
Run a sample Java test build using your preferred method on BrowserStack:
After downloading the sample project, unzip it in the desired location.
Import the downloaded project
Click File β Import. Expand General, select Projects from Folder or Archive, and click Next. Then, navigate to the earlier unzipped downloaded project .
Configure your browserstack.yml config file
The browserstack.yml file holds all the required capabilities to run your tests on BrowserStack
Set access credentials
Set userName and accessKey properties in the browserstack.yml file, available in the root directory, to authenticate your tests on BrowserStack.
Select desktop browsers or real devices from a list of 3000+ available combinations:
Parallel thread
#1
Windows 10
Chrome 120
Parallel thread
#2
OS X Monterey
Safari 15.6
Parallel thread
#3
iOS 15
iPhone 13
Did you know?
You can optimize your web apps for your mobile users by testing them on mobile devices. To get started, select a mobile device above.
After downloading the sample project, unzip it in the desired location.
Import the downloaded project
Click File β Import. Expand General, select Projects from Folder or Archive, and click Next. Then, navigate to the earlier unzipped downloaded project .
Configure your browserstack.yml config file
The browserstack.yml file holds all the required capabilities to run your tests on BrowserStack
Set access credentials
Set userName and accessKey properties in the browserstack.yml file, available in the root directory, to authenticate your tests on BrowserStack.
Select desktop browsers or real devices from a list of 3000+ available combinations:
Parallel thread
#1
Windows 10
Chrome 120
Parallel thread
#2
OS X Monterey
Safari 15.6
Parallel thread
#3
iOS 15
iPhone 13
Did you know?
You can optimize your web apps for your mobile users by testing them on mobile devices. To get started, select a mobile device above.