按照文档步骤来,从初始化开始就多多少少有点问题,直到卡在WebDriver 服务启动,于是从初始化开始解决遇到的问题
问题一 uirecorder init 初始化失败(报错信息)
× Install fail! Error: ENOENT: no such file or directory, open 'D:\uitest\uirecoderTest\node_modules\_@[email protected]@@types\cacheable-request\.npminstall.done'
node:internal/process/promises:279
triggerUncaughtException(err, true /* fromPromise */);
^
[Error: ENOENT: no such file or directory, open 'D:\uitest\uirecoderTest\node_modules\_@[email protected]@@types\cacheable-request\.npminstall.done'] {
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'D:\\uitest\\uirecoderTest\\node_modules\\_@[email protected]@@types\\cacheable-request\\.npminstall.done'
}
解决:
根据报错位置,找到有问题的文件,可以看到cacheable-request不是文件夹,并且缺少npminstall.done,手动添加cacheable-request.npminstall.done(实在是没有找到其他解决办法),再执行uirecorder init进行初始化
** 问题二 ** 启动 webdriver 服务失败(npm run server或selenium-standalone start)
解决:
1、运行selenium-standalone install(可能会报错,多运行几次)
2、检查**package.json **文件,参考链接
{
"name": "uirecorderTest",
"version": "1.0.0",
"description": "",
"main": "",
"dependencies": {
"chai": "3.5.0",
"jwebdriver": "2.3.4",
"mocha": "5",
"macaca-mocha-parallel-tests": "2.x",
"macaca-reporter": "^1.3.24",
"resemblejs-node": "1.0.0",
"selenium-standalone": "6.x.x",
"jquery": "3.x"
},
"devDependencies": {
},
"scripts": {
"installdriver": "selenium-standalone install --drivers.firefox.baseURL=http://npm.taobao.org/mirrors/geckodriver --baseURL=http://npm.taobao.org/mirrors/selenium --drivers.chrome.baseURL=http://npm.taobao.org/mirrors/chromedriver --drivers.ie.baseURL=http://npm.taobao.org/mirrors/selenium",
"server": "selenium-standalone start",
"test": "mocha \"!(node_modules)/**/*.spec.js\" --reporter macaca-reporter --reporter-options reportJSONFilename=index,processAlwaysExitWithZero=true --bail",
"singletest": "mocha --reporter macaca-reporter --reporter-options reportJSONFilename=index,processAlwaysExitWithZero=true --bail",
"paralleltest": "macaca-mocha-parallel-tests \"!(node_modules)/**/*.spec.js\" --reporter macaca-reporter --reporter-options reportJSONFilename=index,processAlwaysExitWithZero=true --max-parallel 5 --bail",
"moduletest": "macaca-mocha-parallel-tests --reporter macaca-reporter --reporter-options reportJSONFilename=index,processAlwaysExitWithZero=true --max-parallel 5 --bail"
},
"author": ""
}
然后依次npm installdriver 和 npm run server
3、1和2没有解决,删除node_modules,重新npm install
版权归原作者 m0_69569615 所有, 如有侵权,请联系我们删除。