Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot use import statement outside a module #380

Open
audioscavenger opened this issue Jan 13, 2023 · 0 comments
Open

[BUG] Cannot use import statement outside a module #380

audioscavenger opened this issue Jan 13, 2023 · 0 comments
Labels

Comments

@audioscavenger
Copy link

Describe the bug

import { installDriver } from 'ms-chromium-edge-driver'
// SyntaxError: Cannot use import statement outside a module
import edge from 'selenium-webdriver/edge'
// SyntaxError: Cannot use import statement outside a module

This is fixed by changing to:

const { installDriver } = require('ms-chromium-edge-driver')
const edge = require("selenium-webdriver/edge")

But then after you create the Options, you get this:

const edgeOptions = new edge.Options()
edgeOptions.setEdgeChromium(true)
// TypeError: global.browser.options.setEdgeChromium is not a function

OS: Win10 x64
Node.js v18.12.0

Package version: 0.5.1

Installation: npm/yarn it does not matter

To Reproduce
Steps to reproduce the behavior:

  1. Run code above
  2. See error
    This is the content of edgeOptions:
    Options {
      map_: Map(2) { 'browserName' => 'MicrosoftEdge', 'ms:edgeOptions' => {} },
      options_: {}
    }

Expected behavior
not sure yet as i cannot have it working at all

Additional context
package.json:

{
  "type": "module",
  "name": "nQpuppeteer",
  "version": "2.8.89",
  "description": "modules required for nQpuppeteer",
  "scripts": {
    "test": "mocha -g testtt ..\\test"
  },
  "private": true,
  "devDependencies": {
    "cleanup": "^0.3.0"
  },
  "dependencies": {
    "axios": "^1.2.2",
    "chai": "^4.3.7",
    "chai-as-promised": "^7.1.1",
    "chromedriver": "^109.0.0",
    "colors": "^1.4.0",
    "fast-csv": "^4.3.6",
    "geckodriver": "^3.2.0",
    "jasmine": "^4.5.0",
    "mocha": "^10.2.0",
    "mocha-chrome": "^2.2.0",
    "ms-chromium-edge-driver": "^0.5.1",
    "puppeteer": "^19.5.2",
    "requirejs": "^2.3.6",
    "selenium-side-runner": "^4.0.0-alpha.36",
    "selenium-webdriver": "^4.7.1",
    "util": "^0.12.5"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant