我得到了错误 - 模块' selenium-webdriver''在尝试在webstorm中运行量角器测试时,没有导出的成员' Promise'

时间:2017-11-30 12:29:45

标签: node.js angular selenium protractor webstorm

以下是我所面临的错误..当我在此处将其编译为JavaScript时,相同的代码正在运行" compile Typescript to JavaScript"。我想在不生成JavaScript文件的情况下执行它。以下是代码段。

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

先谢谢你的帮助......

[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

这是我的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"
  }

1 个答案:

答案 0 :(得分:0)

通过在配置文件中添加以下检查来实现。希望它对某人有所帮助。 "skipLibCheck": true, "noStrictGenericChecks": true.