我在Windows 7 VM上使用grunt-protractor-runner运行e2e测试 我的节点版本是0.10.25 我的量角器版本是2.5.1
我认为问题在于量角器配置。
当我跑步时,我得到了这个:
Using the selenium server at http://127.0.0.1:4444/wd/hub
[launcher] Running 1 instances of WebDriver
ERROR - Unable to start a WebDriver session.
/home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113
var template = new Error(this.message);
^
UnknownError: Unable to find executable for product Opera Desktop
at new bot.Error (/home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113:18)
at Object.bot.response.checkResponse (/home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/response.js:106:9)
at /home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:152:24
at /home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
at notify (/home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)
at notifyAll (/home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:442:7)
at resolve (/home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:420:7)
at fulfill (/home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:535:5)
at /home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
==== async task ====
WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:149:22)
at Function.webdriver.WebDriver.createSession (/home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:123:30)
at Builder.build (/home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/builder.js:294:22)
at DriverProvider.getNewDriver (/home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/lib/driverProviders/driverProvider.js:38:7)
at Runner.createBrowser (/home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/lib/runner.js:180:37)
at /home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/lib/runner.js:257:21
at _fulfilled (/home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/home/luca/my-project/node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/q/q.js:759:13)
[launcher] Process exited with error code 1
>>
Fatal error: protractor exited with code: 1
这是我的配置文件:
'use strict';
/* globals jasmine */
var path = require('path');
var FsCleaner = require('./lib/fs-cleaner');
exports.config = {
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
/* seleniumAddress: 'http://10.0.2.15:4444/wd/hub',
*/
specs: require('./specList.js'),
params: {
screenshotsBasePath: path.resolve(__dirname, './screenshots')
},
capabilities: {
'browserName': 'internet explorer',
'platform': 'ANY',
'version': '9',
// 'ie.ensureCleanSession':true,
// 'nativeEvents':false
},
allScriptsTimeout: 300 * 1000,
getPageTimeout: 300 * 1000,
jasmineNodeOpts: {
defaultTimeoutInterval: 300 * 1000
},
onPrepare: function() {
var SpecReporter = require('jasmine-spec-reporter');
// add jasmine spec reporter
jasmine.getEnv().addReporter(new SpecReporter({
// displayStacktrace: true
displayStacktrace: 'none',
}));
FsCleaner.cleanScreenshotsFolder();
FsCleaner.cleanDownloadFolder();
}
};
答案 0 :(得分:0)
首先,尝试从这里下载IE驱动程序http://www.seleniumhq.org/download/ 尝试使用32位和64位版本。
在我看来,IE中的测试非常混乱。如果你想在win7中测试,即你必须修改regs。要获得更多信息,请查看以下链接:https://code.google.com/p/selenium/issues/detail?id=8302#c18
如果您成功设置了IE和量角器。它可能会出现一些问题。例如:慢打字。有关详细信息,请查看:https://code.google.com/p/selenium/issues/detail?id=5116
但是,如果您使用以前版本的IE驱动程序,它可能会解决慢速键入问题。