Node.js 使用UI在Docker中执行Selenium测试
我尝试在docker机器上运行selenium测试(Node Js),但它显示“Node.js 使用UI在Docker中执行Selenium测试,node.js,selenium,docker,selenium-webdriver,automation,Node.js,Selenium,Docker,Selenium Webdriver,Automation,我尝试在docker机器上运行selenium测试(Node Js),但它显示“TypeError:module.exports.browser.isElementPresent不是函数”” 注: 我可以在本地计算机上成功运行相同的selenium测试 我尝试在docker上运行相同的测试,然后遇到上面的错误 root@6cd7ab2eb6f7:/usr/src#npm run kongaezv2 npm信息如果以“ok”结尾,则有效 npm信息使用npm@4.1.2 npm信息使用nod
TypeError:module.exports.browser.isElementPresent不是函数”
”
注:
- 我可以在本地计算机上成功运行相同的selenium测试
- 我尝试在docker上运行相同的测试,然后遇到上面的错误
root@6cd7ab2eb6f7:/usr/src#npm run kongaezv2
npm信息如果以“ok”结尾,则有效
npm信息使用npm@4.1.2
npm信息使用node@v7.6.0
npm信息生命周期cerebro@0.0.1~prekongaezv2:cerebro@0.0.1
npm信息生命周期cerebro@0.0.1~kongaezv2:cerebro@0.0.1
> cerebro@0.0.1kongaezv2/usr/src
>mocha——递归测试/kongaezv2-t 9000000——记者mochawesome
execFile:tests/kongaezv2
execFilename:tests/kongaezv2.json
康佳EZ V2健全性测试
验证页面标题
title=Konga Ez | Home
Title=Konga Ez | Home
验证==通过::页面:Konga Ez |主页成功显示
1) 使用电子邮件和密码登录
准备好关闭浏览器了吗
验证页面标题
title=Konga Ez | Home
Title=Konga Ez | Home
验证==通过::页面:Konga Ez |主页成功显示
2) 一件物品的色拉
准备好关闭浏览器了吗
验证页面标题
title=Konga Ez | Home
Title=Konga Ez | Home
验证==通过::页面:Konga Ez |主页成功显示
3) 将项目添加到购物车
准备好关闭浏览器了吗
验证页面标题
title=Konga Ez | Home
Title=Konga Ez | Home
验证==通过::页面:Konga Ez |主页成功显示
4) 用吊舱结账
准备好关闭浏览器了吗
0通过(48秒)
4失败
1) Konga EZ V2健全性测试使用电子邮件和密码登录:
TypeError:module.exports.browser.isElementPresent不是函数
位于Object.elementpresent(helpers.js:25:47)
位于Object.validateelementpresent(validations.js:57:13)
在Object.clickbutton(actions.js:74:13)
在frameworks/kongaezv2.js:67:19
在node_modules/async/dist/async.js:3830:24
补充时(node_modules/async/dist/async.js:946:17)
在node_modules/async/dist/async.js:950:9
在每个限制点(node_modules/async/dist/async.js:975:24)
在节点_modules/async/dist/async.js:980:16
并行时(节点模块/async/dist/async.js:3829:5)
在Object.series(node_modules/async/dist/async.js:4684:5)
使用电子邮件登录Object.login(frameworks/kongaezv2.js:65:15)
在上下文中。(tests/kongaezv2/kongaezv2.js:20:19)
运行测试时(node_modules/selenium webdriver/testing/index.js:164:22)
在节点_modules/selenium webdriver/testing/index.js:185:16
在新的ManagedPromise(node_modules/selenium webdriver/lib/promise.js:1085
:7)
在controlFlowExecute(node_modules/selenium webdriver/testing/index.js:18
4:14)
在TaskQueue.execute(node_modules/selenium webdriver/lib/promise.js:3092
:14)
在TaskQueue.executeNext(node_modules/selenium webdriver/lib/promise.js:
3075:27)
异步运行时(node_modules/selenium webdriver/lib/promise.js:2982:25)
在节点_modules/selenium webdriver/lib/promise.js:676:7
在进程中。_tick回调(内部/process/next_tick.js:103:7)
发件人:任务:Konga EZ V2健全性测试使用电子邮件和密码登录
在Context.ret(node_modules/selenium webdriver/testing/index.js:183:10)
在节点_modules/selenium webdriver/testing/index.js:102:5
在ManagedPromise.invokeCallback(节点)模块/selenium webdriver/lib/pro
(密斯:1384:14)
在TaskQueue.execute(node_modules/selenium webdriver/lib/promise.js:3092
:14)
在TaskQueue.executeNext(node_modules/selenium webdriver/lib/promise.js:
3075:27)
异步运行时(node_modules/selenium webdriver/lib/promise.js:2935:27)
在节点_modules/selenium webdriver/lib/promise.js:676:7
在进程中。_tick回调(内部/process/next_tick.js:103:7)
2) Konga EZ V2项目的卫生测试血清:
TypeError:module.exports.browser.isElementPresent不是函数
位于Object.elementpresent(helpers.js:25:47)
位于Object.validateelementpresent(validations.js:57:13)
在Object.sendkeys(actions.js:116:13)
在frameworks/kongaezv2.js:104:19
在node_modules/async/dist/async.js:3830:24
补充时(node_modules/async/dist/async.js:946:17)
在node_modules/async/dist/async.js:950:9
在每个限制点(node_modules/async/dist/async.js:975:24)
在节点_modules/async/dist/async.js:980:16
并行时(节点模块/async/dist/async.js:3829:5)
在Object.series(node_modules/async/dist/async.js:4684:5)
在Object.search(frameworks/kongaezv2.js:98:15)
谢谢@nick\u gabbe安装xvfb为我工作。我用谢谢@nick_Gappe安装xvfb为我工作。我使用了您应该在此处安装更多可用信息您应该在此处安装更多可用信息您是否为带有selenium测试的docker容器安装了虚拟显示?不确定,但我所做的是使用我的docker文件安装chrome,安装Google chrome,运行cd/tmp&&&&&&&&&&&&&&&&&&&&dpkg-i Google-chrome-stable&&U current_amd64.deb&&&&&apt get-y-f安装RUN\wget-q-O-;apt key add-&&echo“deb stable main”>/etc/apt/sources.list.d/google.list&\apt-get-update&\apt-get-install-y google-chrome-stable&\rm-rf/var/lib/apt/lists/*您应该安装类似的东西。然后开始,然后再开始。请看更多内容,但这仅用于您不想看到实际UI的情况。感谢@nick_Gabbe为我安装了xvfb。我通过Xvfbif在Docker中使用了铬,这有助于您接受我的答案。提前感谢。您是否使用selenium测试为docker容器安装了虚拟显示?不确定,但我所做的是使用我的docker文件安装chrome,即安装Google chrome,运行cd/tmp&&&\ \ wget&&\ dpkg-i Google-chrome-stable\ U current\ U amd64.deb&\ apt get-y-f安装运行\ wget-q-O-\ apt键添加-&\ echo“黛布,妈妈
root@6cd7ab2eb6f7:/usr/src# npm run kongaezv2
npm info it worked if it ends with ok
npm info using npm@4.1.2
npm info using node@v7.6.0
npm info lifecycle cerebro@0.0.1~prekongaezv2: cerebro@0.0.1
npm info lifecycle cerebro@0.0.1~kongaezv2: cerebro@0.0.1
> cerebro@0.0.1 kongaezv2 /usr/src
> mocha --recursive tests/kongaezv2 -t 9000000 --reporter mochawesome
execFile: tests/kongaezv2
execFilename: tests/kongaezv2.json
Konga EZ V2 Sanity Test
validating pagetitle
title = Konga Ez | Home
Title = Konga Ez | Home
Validation == PASS :: Page :Konga Ez | Home is displayed successfully
1) Log in with Email and Password
ready to close browser
validating pagetitle
title = Konga Ez | Home
Title = Konga Ez | Home
Validation == PASS :: Page :Konga Ez | Home is displayed successfully
2) Serach for an item
ready to close browser
validating pagetitle
title = Konga Ez | Home
Title = Konga Ez | Home
Validation == PASS :: Page :Konga Ez | Home is displayed successfully
3) Add an item to cart
ready to close browser
validating pagetitle
title = Konga Ez | Home
Title = Konga Ez | Home
Validation == PASS :: Page :Konga Ez | Home is displayed successfully
4) Checkout with POD
ready to close browser
0 passing (48s)
4 failing
1) Konga EZ V2 Sanity Test Log in with Email and Password:
TypeError: module.exports.browser.isElementPresent is not a function
at Object.elementpresent (helpers.js:25:47)
at Object.validateelementpresent (validations.js:57:13)
at Object.clickbutton (actions.js:74:13)
at frameworks/kongaezv2.js:67:19
at node_modules/async/dist/async.js:3830:24
at replenish (node_modules/async/dist/async.js:946:17)
at node_modules/async/dist/async.js:950:9
at eachOfLimit (node_modules/async/dist/async.js:975:24)
at node_modules/async/dist/async.js:980:16
at _parallel (node_modules/async/dist/async.js:3829:5)
at Object.series (node_modules/async/dist/async.js:4684:5)
at Object.login_with_email (frameworks/kongaezv2.js:65:15)
at Context.<anonymous> (tests/kongaezv2/kongaezv2.js:20:19)
at runTest (node_modules/selenium-webdriver/testing/index.js:164:22)
at node_modules/selenium-webdriver/testing/index.js:185:16
at new ManagedPromise (node_modules/selenium-webdriver/lib/promise.js:1085
:7)
at controlFlowExecute (node_modules/selenium-webdriver/testing/index.js:18
4:14)
at TaskQueue.execute_ (node_modules/selenium-webdriver/lib/promise.js:3092
:14)
at TaskQueue.executeNext_ (node_modules/selenium-webdriver/lib/promise.js:
3075:27)
at asyncRun (node_modules/selenium-webdriver/lib/promise.js:2982:25)
at node_modules/selenium-webdriver/lib/promise.js:676:7
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: Konga EZ V2 Sanity Test Log in with Email and Password
at Context.ret (node_modules/selenium-webdriver/testing/index.js:183:10)
at node_modules/selenium-webdriver/testing/index.js:102:5
at ManagedPromise.invokeCallback_ (node_modules/selenium-webdriver/lib/pro
mise.js:1384:14)
at TaskQueue.execute_ (node_modules/selenium-webdriver/lib/promise.js:3092
:14)
at TaskQueue.executeNext_ (node_modules/selenium-webdriver/lib/promise.js:
3075:27)
at asyncRun (node_modules/selenium-webdriver/lib/promise.js:2935:27)
at node_modules/selenium-webdriver/lib/promise.js:676:7
at process._tickCallback (internal/process/next_tick.js:103:7)
2) Konga EZ V2 Sanity Test Serach for an item:
TypeError: module.exports.browser.isElementPresent is not a function
at Object.elementpresent (helpers.js:25:47)
at Object.validateelementpresent (validations.js:57:13)
at Object.sendkeys (actions.js:116:13)
at frameworks/kongaezv2.js:104:19
at node_modules/async/dist/async.js:3830:24
at replenish (node_modules/async/dist/async.js:946:17)
at node_modules/async/dist/async.js:950:9
at eachOfLimit (node_modules/async/dist/async.js:975:24)
at node_modules/async/dist/async.js:980:16
at _parallel (node_modules/async/dist/async.js:3829:5)
at Object.series (node_modules/async/dist/async.js:4684:5)
at Object.search (frameworks/kongaezv2.js:98:15)