问题描述
我正在 Gitlab CI 中为 selenium 中的自动化测试设置 CI 作业,但由于该问题,测试失败.
I'm setting up the CI job for automated testing in selenium inside Gitlab CI, but the test is failing due to the issue.
019-09-27T11:03:17.404Z INFO @wdio/cli:Launcher: 运行 onPrepare 钩子/builds/shuryav/test-react-ci-cd/node_modules/chromedriver/lib/chromedriver/chromedriver:加载共享库时出错:libnss3.so:无法打开共享对象文件:没有这样的文件或目录
019-09-27T11:03:17.404Z INFO @wdio/cli:Launcher: Run onPrepare hook/builds/shauryav/test-react-ci-cd/node_modules/chromedriver/lib/chromedriver/chromedriver: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
我尝试了多种解决方案,例如安装包 "@wdio/cli": "^5.13.2", "webdriverio": "^5.13.2",但没有任何效果.对于注释,我没有使用任何 docker 设置
I have tried numbers of solutions like installing package "@wdio/cli": "^5.13.2", "webdriverio": "^5.13.2" but nothing works. For the note, I'm not using any docker setup
/builds/shauryav/test-react-ci-cd/node_modules/chromedriver/lib/chromedriver/chromedriver: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
2019-09-27T11:03:27.415Z ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hook
Error: timeout
at Timeout.timeoutFunc (/builds/shauryav/test-react-ci-cd/node_modules/tcp-port-used/index.js:204:25)
at listOnTimeout (internal/timers.js:531:17)
at processTimers (internal/timers.js:475:7)```
推荐答案
试试这些命令
apt install libnss
apt install libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev
如果上面的命令不起作用,那就去下面的一个
if the above commands didn't work then go for the below one
sudo apt install libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev
这篇关于“加载共享库时出错:libnss3.so"在运行 Gtlab CI 作业以使用 webdriverio 执行自动化测试时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!