Skip to content

[🐛 Bug]: pkg to exe #15286

@cong2535

Description

@cong2535

What happened?

Error: Failed to import atoms module get-attribute.js. If running in dev mode, you need to run bazel build //javascript/node/selenium-webdriver/lib/atoms:get-attribute.js from the projectroot: Error: Cannot find module './atoms/get-attribute.js'
Require stack:

  • C:\snapshot\selenium-node\node_modules\selenium-webdriver\lib\http.js
  • C:\snapshot\selenium-node\node_modules\selenium-webdriver\http\index.js
  • C:\snapshot\selenium-node\node_modules\selenium-webdriver\index.js
  • C:\snapshot\selenium-node\index.js
  1. If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
    at requireAtom (C:\snapshot\selenium-node\node_modules\selenium-webdriver\lib\http.js:58:13)
    at Object. (C:\snapshot\selenium-node\node_modules\selenium-webdriver\lib\http.js:39:22)
    at Module._compile (pkg/prelude/bootstrap.js:1926:22)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at Module.require (pkg/prelude/bootstrap.js:1851:31)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object. (C:\snapshot\selenium-node\node_modules\selenium-webdriver\http\index.js:29:17)

How can we reproduce the issue?

try{

  const { Builder, Browser, By, Key, until } = require('selenium-webdriver')

  ;(async function example() {
    let driver = await new Builder().forBrowser(Browser.EDGE).build()
    try {
      await driver.get('https://www.baidu.com')
      await new Promise((resolve) => {
        setTimeout(() => {
          resolve()
        }, 3000)
      })
    }finally {
      await driver.quit()
    }
  })()
}catch (e) {
  console.log(e)
}

Relevant log output

Error: Failed to import atoms module get-attribute.js. If running in dev mode, you need to run `bazel build //javascript/node/selenium-webdriver/lib/atoms:get-attribute.js` from the projectroot: Error: Cannot find module './atoms/get-attribute.js'
Require stack:
- C:\snapshot\selenium-node\node_modules\selenium-webdriver\lib\http.js
- C:\snapshot\selenium-node\node_modules\selenium-webdriver\http\index.js
- C:\snapshot\selenium-node\node_modules\selenium-webdriver\index.js
- C:\snapshot\selenium-node\index.js
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
    at requireAtom (C:\snapshot\selenium-node\node_modules\selenium-webdriver\lib\http.js:58:13)
    at Object.<anonymous> (C:\snapshot\selenium-node\node_modules\selenium-webdriver\lib\http.js:39:22)
    at Module._compile (pkg/prelude/bootstrap.js:1926:22)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at Module.require (pkg/prelude/bootstrap.js:1851:31)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\snapshot\selenium-node\node_modules\selenium-webdriver\http\index.js:29:17)

Operating System

win11

Selenium version

javascript

What are the browser(s) and version(s) where you see this issue?

edge

What are the browser driver(s) and version(s) where you see this issue?

edge

Are you using Selenium Grid?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!I-defectSomething is not working as intendedI-questionApplied to questions. Issues should be closed and send the user to community resources.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions