node.jsangularselenium-webdriverprotractorwebstorm

I am getting and error as - Module ''selenium-webdriver'' has no exported member 'Promise', while trying to run protractor tests in WebStorm


Below is the error I am facing... The same code is working when I compile it to JavaScript here "compile TypeScript to JavaScript". I would like to execute it without generating the JavaScript files. Below is the code snippet.

getIndusElem(): Promise<string> {
    return element(by.id('industry')).getText()
  }

Result

[15:10:39] I/launcher - Running 1 instances of WebDriver
[15:10:39] I/direct - Using ChromeDriver directly...
[15:10:45] E/launcher - Error: TSError: ⨯ Unable to compile TypeScript
e2e\app.po.ts (2,10): Module '"C:/Venkat/new/test/solaris/node_modules/@types/selenium-webdriver/index"' has no exported member 'Promise'. (2305)
    at getOutput (C:\Venkat\new\test\solaris\node_modules\ts-node\src\index.ts:307:15)
    at C:\Venkat\new\test\solaris\node_modules\ts-node\src\index.ts:336:16
    at Object.compile (C:\Venkat\new\test\solaris\node_modules\ts-node\src\index.ts:496:11)
    at Module.m._compile (C:\Venkat\new\test\solaris\node_modules\ts-node\src\index.ts:392:43)
    at Module._extensions..js (module.js:646:10)
    at Object.require.extensions.(anonymous function) [as .ts] (C:\Venkat\new\test\solaris\node_modules\ts-node\src\index.ts:395:12)
    at Module.load (C:\Venkat\new\test\solaris\node_modules\coffee-script\lib\coffee-script\register.js:45:36)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Venkat\new\test\solaris\e2e\context_selector.e2e-spec.ts:2:1)
    at Module._compile (module.js:635:30)
    at Module.m._compile (C:\Venkat\new\test\solaris\node_modules\ts-node\src\index.ts:392:23)
    at Module._extensions..js (module.js:646:10)
    at Object.require.extensions.(anonymous function) [as .ts] (C:\Venkat\new\test\solaris\node_modules\ts-node\src\index.ts:395:12)
    at Module.load (C:\Venkat\new\test\solaris\node_modules\coffee-script\lib\coffee-script\register.js:45:36)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at C:\Venkat\new\test\solaris\node_modules\jasmine\lib\jasmine.js:93:5
    at Array.forEach (<anonymous>)
    at Jasmine.loadSpecs (C:\Venkat\new\test\solaris\node_modules\jasmine\lib\jasmine.js:92:18)
    at Jasmine.execute (C:\Venkat\new\test\solaris\node_modules\jasmine\lib\jasmine.js:197:8)
    at C:\Venkat\new\test\solaris\node_modules\protractor\built\frameworks\jasmine.js:132:15
    at Function.promise (C:\Venkat\new\test\solaris\node_modules\protractor\node_modules\q\q.js:682:9)
    at C:\Venkat\new\test\solaris\node_modules\protractor\built\frameworks\jasmine.js:104:14

Here are my devDependencies...

"devDependencies": {
    "@angular/cli": "1.5.0-rc.3",
    "@angular/compiler-cli": "^5.0.0-rc.6",
    "@angular/language-service": "^5.0.0-rc.6",
    "@compodoc/compodoc": "^1.0.4",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "angular-split": "^0.2.7",
    "archiver": "2.0.0",
    "codelyzer": "~3.2.0",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "normalize.css": "^7.0.0",
    "primeng": "^5.0.0",
    "protractor": "~5.1.2",
    "quill": "^1.3.4",
    "sync-request": "4.0.3",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.4.2"
  }

Solution

  • It worked by adding the below checks in the configuration file.

    "skipLibCheck": true, "noStrictGenericChecks": true.