Skip to content

[🐛 Bug]: No "browserName" defined in capabilities nor hostname or port found! #11398

@amrsa1

Description

@amrsa1

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

8.17.0

Node.js Version

18.16.1

Mode

WDIO Testrunner

Which capabilities are you using?

DesktopApp =
    [{
      "appium:path": '/wd/hub',
      "appium:hostname": '127.0.0.1',
      "appium:app": "C:\\Program Files (x86)\\Evernote\\Evernote.exe",
      "appium:platformName": "windows",
      "appium:deviceName": "WindowsPC",
      "ms:waitForAppLaunch": '20',
    }]

exports.config = {
    ...config,
    ...{

        specs: [
        '../specs/03.1_WinApp_Suite.ts',
        ],
        capabilities: caps.DesktopApp,
        services: [['appium',{
            args: {
                debugLogSpacing: true,
                sessionOverride: true,
                address: 'localhost',
                port: 4723,
                hostname: "127.0.0.1",
                relaxedSecurity: true
            }}
        ]]
    }

}

What happened?

Unable to execute the test against desktop app due to the following error

[0-0] 2023-10-10T20:49:42.391Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2023-10-10T20:49:42.391Z ERROR @wdio/runner: Error: No "browserName" defined in capabilities nor hostname or port found!
[0-0] If you like to run a mobile session with Appium, make sure to set "hostname" and "port" in your WebdriverIO options. If you like to run a local browser session make sure to pick from one of the following browser names: chrome,googlechrome,chromium,chromium-browser,firefox,ff,mozilla,mozilla firefox,edge,microsoftedge,msedge,safari,safari technology preview
[0-0]     at startWebDriver (file:///Users/amrsa/Desktop/wido-ultimate/node_modules/@wdio/utils/build/driver/index.js:41:15)
[0-0]     at Function.newSession (file:///Users/amrsa/Desktop/wido-ultimate/node_modules/webdriver/build/index.js:25:37)
[0-0]     at remote (file:///Users/amrsa/Desktop/wido-ultimate/node_modules/webdriverio/build/index.js:45:35)
2023-10-10T20:49:42.499Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1

What is your expected behavior?

Session should not be interrupted due to missing browserName

How to reproduce the bug.

Upgrade to the latest webdriverio version, execute the test against any desktop App

Relevant log output

amrsa@Amrs-MacBook-Pro wido-ultimate % npx wdio run src/test/config/desktopApp.conf.ts
{
  autoCompileOpts: {
    autoCompile: true,
    tsNodeOpts: { transpileOnly: true, project: './tsconfig.json' }
  },
  capabilities: [
    {
      'appium:path': '/wd/hub',
      'appium:hostname': '127.0.0.1',
      'appium:app': 'C:\\Program Files (x86)\\Evernote\\Evernote.exe',
      'appium:platformName': 'windows',
      'appium:deviceName': 'WindowsPC',
      'ms:waitForAppLaunch': '20'
    }
  ],
  exclude: [],
  maxInstances: 1,
  logLevel: 'trace',
  bail: 0,
  waitforTimeout: 20000,
  connectionRetryTimeout: 90000,
  connectionRetryCount: 3,
  framework: 'mocha',
  mochaOpts: { ui: 'bdd', timeout: 120000, retries: 0 },
  afterTest: [AsyncFunction: afterTest],
  reporters: [ 'spec', [ 'allure', [Object] ] ],
  specs: [ '../specs/03.1_WinApp_Suite.ts' ],
  services: [ [ 'appium', [Object] ] ]
}

Execution of 1 workers started at 2023-10-10T20:49:40.757Z

2023-10-10T20:49:40.764Z DEBUG @wdio/utils:initialiseServices: initialise service "appium" as NPM package
2023-10-10T20:49:40.769Z INFO @wdio/cli:launcher: Run onPrepare hook
2023-10-10T20:49:40.770Z INFO @wdio/appium-service: Will spawn Appium process: node /Users/amrsa/Desktop/wido-ultimate/node_modules/appium/index.js --base-path / --debug-log-spacing --session-override --address localhost --port 4723 --hostname 127.0.0.1 --relaxed-security
2023-10-10T20:49:41.734Z ERROR @wdio/appium-service: Appium exited before timeout (exit code: 1)


2023-10-10T20:49:41.735Z ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hook
Error: Appium exited before timeout (exit code: 1)


    at ChildProcess.<anonymous> (file:///Users/amrsa/Desktop/wido-ultimate/node_modules/@wdio/appium-service/build/launcher.js:140:22)
    at Object.onceWrapper (node:events:628:26)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess.emit (node:domain:489:12)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)

Continue...
2023-10-10T20:49:41.735Z DEBUG @wdio/cli:utils: Finished to run "onPrepare" hook in 965ms
2023-10-10T20:49:41.736Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2023-10-10T20:49:41.736Z DEBUG @wdio/cli:utils: Finished to run "onWorkerStart" hook in 0ms
2023-10-10T20:49:41.737Z INFO @wdio/local-runner: Start worker 0-0 with arg: run,src/test/config/desktopApp.conf.ts
2023-10-10T20:49:41.738Z DEBUG @wdio/local-runner: Send command run to worker with cid "0-0"
[0-0] 2023-10-10T20:49:42.214Z INFO @wdio/local-runner: Run worker command: run
[0-0] {
[0-0]   autoCompileOpts: {
[0-0]     autoCompile: true,
[0-0]     tsNodeOpts: { transpileOnly: true, project: './tsconfig.json' }
[0-0]   },
[0-0]   capabilities: [
[0-0]     {
[0-0]       'appium:path': '/wd/hub',
[0-0]       'appium:hostname': '127.0.0.1',
[0-0]       'appium:app': 'C:\\Program Files (x86)\\Evernote\\Evernote.exe',
[0-0]       'appium:platformName': 'windows',
[0-0]       'appium:deviceName': 'WindowsPC',
[0-0]       'ms:waitForAppLaunch': '20'
[0-0]     }
[0-0]   ],
[0-0]   exclude: [],
[0-0]   maxInstances: 1,
[0-0]   logLevel: 'trace',
[0-0]   bail: 0,
[0-0]   waitforTimeout: 20000,
[0-0]   connectionRetryTimeout: 90000,
[0-0]   connectionRetryCount: 3,
[0-0]   framework: 'mocha',
[0-0]   mochaOpts: { ui: 'bdd', timeout: 120000, retries: 0 },
[0-0]   afterTest: [AsyncFunction: afterTest],
[0-0]   reporters: [ 'spec', [ 'allure', [Object] ] ],
[0-0]   specs: [ '../specs/03.1_WinApp_Suite.ts' ],
[0-0]   services: [ [ 'appium', [Object] ] ]
[0-0] }
[0-0] 2023-10-10T20:49:42.285Z DEBUG @wdio/runner: init remote session
[0-0] 2023-10-10T20:49:42.287Z DEBUG @wdio/utils:initialiseServices: initialise service "appium" as NPM package
[0-0] RUNNING in windows - file:///src/test/specs/03.1_WinApp_Suite.ts
[0-0] 2023-10-10T20:49:42.391Z DEBUG @wdio/runner: init remote session
[0-0] 2023-10-10T20:49:42.391Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2023-10-10T20:49:42.391Z ERROR @wdio/runner: Error: No "browserName" defined in capabilities nor hostname or port found!
[0-0] If you like to run a mobile session with Appium, make sure to set "hostname" and "port" in your WebdriverIO options. If you like to run a local browser session make sure to pick from one of the following browser names: chrome,googlechrome,chromium,chromium-browser,firefox,ff,mozilla,mozilla firefox,edge,microsoftedge,msedge,safari,safari technology preview
[0-0]     at startWebDriver (file:///Users/amrsa/Desktop/wido-ultimate/node_modules/@wdio/utils/build/driver/index.js:41:15)
[0-0]     at Function.newSession (file:///Users/amrsa/Desktop/wido-ultimate/node_modules/webdriver/build/index.js:25:37)
[0-0]     at remote (file:///Users/amrsa/Desktop/wido-ultimate/node_modules/webdriverio/build/index.js:45:35)
2023-10-10T20:49:42.499Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1
[0-0] FAILED in windows - file:///src/test/specs/03.1_WinApp_Suite.ts
2023-10-10T20:49:42.500Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2023-10-10T20:49:42.500Z DEBUG @wdio/cli:utils: Finished to run "onWorkerEnd" hook in 0ms
2023-10-10T20:49:42.500Z INFO @wdio/cli:launcher: Run onComplete hook
2023-10-10T20:49:42.500Z DEBUG @wdio/cli:utils: Finished to run "onComplete" hook in 0ms

Spec Files:      0 passed, 1 failed, 1 total (100% completed) in 00:00:01 

2023-10-10T20:49:42.501Z INFO @wdio/local-runner: Shutting down spawned worker
2023-10-10T20:49:42.754Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2023-10-10T20:49:42.755Z INFO @wdio/local-runner: shutting down


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

### Is there an existing issue for this?

- [X] I have searched the existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🐛help wantedIssues that are free to take by anyone interested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions