Skip to content

[🐛 Bug]: WebdriverIO V9 support with AWS Device Farm #13893

@ghost

Description

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.2.14

Node.js Version

20.18.0

Mode

Standalone Mode

Which capabilities are you using?

{
  browserName: "chrome"
}

What happened?

Running my local webdriverIO script on AWS Device Farm Browser Testing using TestGridUrl by following AWS Device Farm Docs https://docs.aws.amazon.com/devicefarm/latest/testgrid/testing-frameworks-nodejs.html

Getting error related to websocketURL running on 127.0.0.1:8080, not able to set websocketURL or disable it.

What is your expected behavior?

AWS Device Farm Desktop Browser Session should be created and steps should have been performed without any errors on AWS Device Farm Desktop browser testing.

How to reproduce the bug.

Node -> 20.18.0

  1. npm init -y
  2. npm i @wdio/cli@latest @wdio/local-runner @wdio/mocha-framework aws-sdk
  3. Create a script file as mentioned in https://docs.aws.amazon.com/devicefarm/latest/testgrid/testing-frameworks-nodejs.html
const webdriverio = require('webdriverio');
const AWS = require("aws-sdk");

var PROJECT_ARN = process.env.TEST_GRID_PROJECT
var devicefarm = new AWS.DeviceFarm({ region: "us-west-2" });

(async () => {
    // Get a new signed WebDriver hub URL.
    const testGridUrlResult = await devicefarm.createTestGridUrl({
        projectArn: PROJECT_ARN,
        expiresInSeconds: 600
    }).promise();

    console.log("Created url result:", testGridUrlResult);
    runExample(testGridUrlResult.url);

})().catch((e) => console.error(e));

var runExample = async (urlString) => {
    var url = new URL(urlString)

    console.log("Starting a new remote driver")
    const browser = await webdriverio.remote({
        logLevel: 'trace',
        hostname: url.host,
        path: url.pathname,
        protocol: 'https',
        port: 443,
        connectionRetryTimeout: 180000,
        capabilities: {
            browserName: 'chrome',
        }
    })

    await browser.url('https://aws.amazon.com/')

    const title = await browser.getTitle()
    console.log('Title was: ' + title)

    await browser.deleteSession()
}
  1. Run the script

Relevant log output

node:events:497
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 127.0.0.1:8080
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1607:16)
Emitted 'error' event on WebSocket instance at:
    at emitErrorAndClose (/Users/devansh/Desktop/testing-aws-device-farm-v2/node_modules/ws/lib/websocket.js:1041:13)
    at ClientRequest.<anonymous> (/Users/devansh/Desktop/testing-aws-device-farm-v2/node_modules/ws/lib/websocket.js:881:5)
    at ClientRequest.emit (node:events:519:28)
    at ClientRequest.emit (node:domain:488:12)
    at emitErrorEvent (node:_http_client:101:11)
    at Socket.socketErrorListener (node:_http_client:504:5)
    at Socket.emit (node:events:519:28)
    at Socket.emit (node:domain:488:12)
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3) {
  errno: -61,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 8080
}

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions