webdriverio/webdriverio

[🐛 Bug]: BROWSERSTACK_MISSING_CAPS when trying to have both Browserstack and "Chrome standalone"

Open

#14.429 aberto em 23 de abr. de 2025

Ver no GitHub
 (7 comments) (0 reactions) (0 assignees)JavaScript (1.793 forks)batch import
Bug 🐛help wanted

Métricas do repositório

Stars
 (6.029 stars)
Métricas de merge de PR
 (Mesclagem média 15d 15h) (48 fundiu PRs em 30d)

Description

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

latest

Mode

WDIO Testrunner

Which capabilities are you using?

{
        browserName: 'chrome',
        maxInstances: 1,
        'goog:chromeOptions': {
            args: ['--headless', '--disable-gpu', '--no-sandbox', '--disable-dev-shm-usage']
        }
    }

What happened?

I want to run both against Browserstack App Live (a mobile app) AND perform API calls outside of said app. In order to do that I have browserstack service, and I'm creating a standalone browser against it. Then, in my conf file, I only have a headless chrome. This has worked for me in other runners using multiple browsers, and using appium + chrome, but fails with browserstack.

I tried several ways of removing all bstack:options capabilities so that Browserstack service doesn't pick chrome as a browser it should instantiate but couldn't make it work.

Also, the documentation mentions a use case like mine here https://webdriver.io/docs/multiremote/#using-wdio-testrunner , but it is outdated since it suggests using the selenium-standalone service (and I tried anyway).

Similar conf but with appium works like this:

    // Headless Chrome capabilities
    capabilities: [{
        browserName: 'chrome',
        maxInstances: 1,
        'goog:chromeOptions': {
            args: ['--headless', '--disable-gpu', '--no-sandbox', '--disable-dev-shm-usage']
        }
    }],

    services: [
        ['appium', {
            args: {
                address: 'localhost',
                port: 4723,
            },
            logPath: './logs'
        }],
        ['shared-store'],
    ],

For both cases, I instantiate the secondary browser with:

browser = await remote({
            hostname: hostname,
            port: port,
            path: path,
            capabilities
        })

What is your expected behavior?

If the capabilities don't have bstack:options, instantiate a standalone chrome (NOT using Browserstack).

How to reproduce the bug.

Conf file extract:

    // Headless Chrome capabilities
    capabilities: [{
        browserName: 'chrome',
        maxInstances: 1,
        'goog:chromeOptions': {
            args: ['--headless', '--disable-gpu', '--no-sandbox', '--disable-dev-shm-usage']
        }
    }],

    user: process.env.BROWSERSTACK_USERNAME,
    key: process.env.BROWSERSTACK_ACCESS_KEY,
    services: [
        ['browserstack', {
            app: process.env.IOS_APP_ID,
            buildIdentifier: "${BUILD_NUMBER}",
            browserstackLocal: true,
            testObservability: true,
            percy: false,
            percyCaptureMode: 'auto'
        }],
        ['shared-store'],
    ],

Relevant log output

[0-0] 2025-04-23T17:19:07.240Z WARN webdriver: WebDriverError: [BROWSERSTACK_MISSING_CAPS] The ["platformName"] capabilities are missing in your test script. Please refer to our capability builder - https://www.browserstack.com/app-automate/capabilities?tag=w3c when running "https://hub-cloud.browserstack.com/wd/hub/session" with method "POST" and args "{"capabilities":{"alwaysMatch":{"browserName":"chrome","goog:chromeOptions":{"args":["--headless","--disable-gpu","--no-sandbox","--disable-dev-shm-usage"]},"bstack:options":{"wdioService":"9.7.1","testhubBuildUuid":"SOMETHING","buildProductMap":{"observability":true,"accessibility":false,"percy":false,"automate":false,"app_automate":true},"local":true},"wdio:sharedStoreServicePort":46735,"appium:app":"bs://SOMETHING","webSocketUrl":true,"unhandledPromptBehavior":"ignore"},"firstMatch":[{}]}}"

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Guia do colaborador