Puppeteer testing on BrowserStack
A quickstart guide to running your Puppeteer tests across 100+ desktop browsers on BrowserStack.
Quickstart
Running your first Puppeteer test suite on BrowserStack is super easy. Here’s a quick start guide to help you get started with Puppeteer testing on BrowserStack in under 2 minutes.
Step 1: Clone our sample repository and install dependencies
All our sample tests are available on this GitHub repository. The first step is to download this repository on your system and install the dependencies as shown below:
Step 2: Configuring BrowserStack credentials
If you have not created an account yet, you can sign up for a Free Trial or purchase a plan.
All our sample scripts need your BrowserStack credentials to run. Please set the environment variables BROWSERSTACK_USERNAME
and BROWSERSTACK_ACCESS_KEY
with your credentials as shown below:
Alternatively, your can put your credentials in the browserstack.username
and browserstack.accessKey
capabilities in the duckduckgo_search.js
file (and all other files) in the sample repository.
Step 3: Run your first test
After you have configured the credentials and installed the npm dependencies, you can invoke your first Puppeteer test on BrowserStack using the following:
Step 4: View your test results on the Automate Dashboard
After the test has run, you can access the test results on the BrowserStack Automate dashboard. You can learn more about viewing test results on Automate Dashboard.
Details of your first test
In this section, we will walk you through the details of the first test that you just ran and also explain the changes that you need to make in your existing Puppeteer scripts to make them run on BrowserStack.
The sample script that has run, is shown below (see in GitHub):
You can learn more about how to make your existing Puppeteer scripts run on BrowserStack and you can also learn about how to test against your privately hosted websites.
Next Steps
- Learn how to run cross-browser Puppeteer tests in parallel
- Learn how to test localhost and staging websites
- Migrate your existing test suites to run on BrowserStack
- Run your CodeceptJS Puppeteer tests on BrowserStack
- Run your Jest Puppeteer tests on BrowserStack
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!