Skip to content

[🐛 Bug]: Error: Can't read files form file system in this environment #14096

@mykola-mokhnach

Description

@mykola-mokhnach

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.6.0

Node.js Version

22

Mode

Standalone Mode

Which capabilities are you using?

{
  "alwaysMatch": {
    "platformName": "Fake",
    "appium:automationName": "Fake",
    "appium:deviceName": "Fake",
    "appium:app": "/home/runner/work/appium/appium/packages/images-plugin/local_appium_home/node_modules/@appium/fake-driver/test/fixtures/app.xml"
  },
  "firstMatch": [
    {}
  ]
}

What happened?

The below code to find element by image started throwing errors since update to wdio 9.6.0:

    // APPSTORE_IMG_PATH == '/Users/elf/code/appium/packages/images-plugin/test/fixtures/appstore.png'
    const imageEl = await driver.$(APPSTORE_IMG_PATH);

The test itself could be located at https://github.com/appium/appium/blob/2409d3223a77aa7e84e0cb05a70be3bfa0c69157/packages/images-plugin/test/e2e/plugin.e2e.spec.js#L84

Previous WDIO versions did not have this issue

What is your expected behavior?

No exception

How to reproduce the bug.

Check CI logs for appium/appium#20922, for example https://github.com/appium/appium/actions/runs/12914617020/job/36014606590?pr=20922

Relevant log output

1) ImageElementPlugin
       should find and interact with image elements:
     Error: Can't read files form file system in this environment
      at Object.get readFileSync [as readFileSync] (file:///home/runner/work/appium/appium/node_modules/webdriverio/build/index.js:521:13)
      at findStrategy (file:///home/runner/work/appium/appium/node_modules/webdriverio/build/index.js:7367:33)
      at Browser.findElement (file:///home/runner/work/appium/appium/node_modules/webdriverio/build/index.js:8054:30)
      at Browser.$ (file:///home/runner/work/appium/appium/node_modules/webdriverio/build/index.js:450:33)
      at Browser.wrapCommandFn (file:///home/runner/work/appium/appium/node_modules/@wdio/utils/build/index.js:893:32)
      at file:///home/runner/work/appium/appium/node_modules/@wdio/utils/build/index.js:910:50
      at processTicksAndRejections (node:internal/process/task_queues:95:5)

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

    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