无法在Intern / Leadfoot中加载模块已安装的模块

时间:2016-06-29 13:13:18

标签: selenium selenium-webdriver intern leadfoot

Meta -

操作系统:Ubuntu 14。 Selenium版本:2.53
浏览器:Chrome。 浏览器版本:51.0.2704.103(64位)

预期行为 -

进口了硒驱动剂。

实际行为 -

不会导入硒驱动程序。

Got following parameters:
seleniumserver.port: 4444
chrome.driver.path: selenium/chromedriver/linux64/chromedriver
kibi.url: http://192.168.50.10
kibi.shield.password: undefined
kibi.shield.username: undefined
Running "intern:community" (intern) task
Error: Failed to load module node_modules/selenium-webdriver from /home/trex/Development/Siren/kibi-integration/node_modules/selenium-webdriver.js (parent: tests/functional/support/page/Datasource)
  at ReadFileContext.callback  <node_modules/intern/node_modules/dojo/loader.ts:831:119>
  at FSReqWrap.readFileAfterOpen [as oncomplete]  <fs.js:303:13>
Warning: Test failure; check output above for details. Use --force to continue.

重现的步骤 -

我使用Intern编写测试。 我的一段代码。 cat tests/functional/community/index.js

/*global define*/
define([
  'intern!object',
  'intern/chai!assert',
  'require',
  '../support/page/EnhSearchTable',
  '../support/page/KibiDashboard',
  '../support/page/Datasource'
], function (registerSuite, assert, require, EnhSearchTable, KibiDashboard, Datasource) {
  var intern = require('intern');
  var args = intern.args;
  var webdriver = require('selenium-webdriver');
  var driver = new webdriver.Builder().build();
...
...
...
});

node_modules中的selenium-driver的内容:

tree -L 1 /home/trex/Development/Siren/kibi-integration/node_modules/sel
enium-webdriver/
/home/trex/Development/Siren/kibi-integration/node_modules/selenium-webdriver/
├── builder.js
├── CHANGES.md
├── chrome.js
├── edge.js
├── error.js
├── example
├── executors.js
├── firefox
├── http
├── ie.js
├── index.js
├── io
├── lib
├── LICENSE
├── net
├── node_modules
├── NOTICE
├── opera.js
├── package.json
├── phantomjs.js
├── proxy.js
├── README.md
├── remote
├── safari.js
├── test
└── testing

1 个答案:

答案 0 :(得分:1)

要在AMD测试中加载Node模块,您需要使用intern/dojo/node加载器插件。尝试:

var webdriver = require('intern/dojo/node!selenium-webdriver')