Angularjs 量角器和appium-无法读取未定义的属性
我想在安卓设备上做一些硒测试。 所有的连接接缝都可以工作,在设备上我可以看到chrome打开,然后url变为数据 但是在url改变后,一切都停止了 [launcher]错误:TypeError:无法读取module.exports(C:\src\angular test\node\u modules\wd bridge\lib\wd bridge.js:6:13)处未定义的属性“Q” 我认为这与wdBridge有关,好像我检查了wdBridge,js,Q,如下所示:Angularjs 量角器和appium-无法读取未定义的属性,angularjs,selenium,protractor,appium,selenium-chromedriver,Angularjs,Selenium,Protractor,Appium,Selenium Chromedriver,我想在安卓设备上做一些硒测试。 所有的连接接缝都可以工作,在设备上我可以看到chrome打开,然后url变为数据 但是在url改变后,一切都停止了 [launcher]错误:TypeError:无法读取module.exports(C:\src\angular test\node\u modules\wd bridge\lib\wd bridge.js:6:13)处未定义的属性“Q” 我认为这与wdBridge有关,好像我检查了wdBridge,js,Q,如下所示: var Q = wd.Q;
var Q = wd.Q;
"use strict";
var wd = require('wd');
var protractor = require ('protractor');
var wdBridge = require('wd-bridge')(protractor,wd);
exports.config = {
specs: ['e2e/*.js'],
framework: 'jasmine',
capabilities: {
'appium-version': '',
'platformName': 'Android',
'platformVersion': '6.0',
'deviceName': 'Android Device',
'autoWebView': true,
'app': "C:/src/angular-test/platforms/android/build/outputs/apk/android-debug.apk",
'udid': '',
'fullReset': true,
'browserName': 'chrome'
},
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function () {
}
},
onPrepare: function () {
var DisplayProcessor = require('../node_modules/jasmine-spec-reporter/src/display-processor');
var SpecReporter = require('jasmine-spec-reporter');
function TimeProcessor(options) {
}
function getTime() {
var now = new Date();
return now.getHours() + ':' +
now.getMinutes() + ':' +
now.getSeconds()
}
TimeProcessor.prototype = new DisplayProcessor();
TimeProcessor.prototype.displaySuite = function (suite, log) {
return getTime() + ' - ' + log;
};
TimeProcessor.prototype.displaySuccessfulSpec = function (spec, log) {
return getTime() + ' - ' + log;
};
TimeProcessor.prototype.displayFailedSpec = function (spec, log) {
return getTime() + ' - ' + log;
};
TimeProcessor.prototype.displayPendingSpec = function (spec, log) {
return getTime() + ' - ' + log;
};
// add jasmine spec reporter
var reporter = new SpecReporter({
customProcessors: [TimeProcessor]
});
jasmine.getEnv().addReporter(reporter);
wdBridge.initFromProtractor(exports.config);
},
//seleniumAddress: 'http://localhost:4723/wd/hub' //For mobile devices
seleniumAddress: 'http://localhost:4444/wd/hub' //For desktop
};
我不知道为什么它不起作用
我的量角器配置文件如下所示:
"use strict";
exports.config = {
specs: ['e2e/*.js'],
framework: 'jasmine',
capabilities: {
'appium-version': '',
'platformName': 'Android',
'platformVersion': '6.0',
'deviceName': 'Android Device',
'autoWebView': true,
'app': "C:/src/angular-test/platforms/android/build/outputs/apk/android-debug.apk",
'udid': '',
'fullReset': true,
'browserName': 'chrome'
},
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function () {
}
},
onPrepare: function () {
var DisplayProcessor = require('../node_modules/jasmine-spec-reporter/src/display-processor');
var SpecReporter = require('jasmine-spec-reporter');
function TimeProcessor(options) {
}
function getTime() {
var now = new Date();
return now.getHours() + ':' +
now.getMinutes() + ':' +
now.getSeconds()
}
TimeProcessor.prototype = new DisplayProcessor();
TimeProcessor.prototype.displaySuite = function (suite, log) {
return getTime() + ' - ' + log;
};
TimeProcessor.prototype.displaySuccessfulSpec = function (spec, log) {
return getTime() + ' - ' + log;
};
TimeProcessor.prototype.displayFailedSpec = function (spec, log) {
return getTime() + ' - ' + log;
};
TimeProcessor.prototype.displayPendingSpec = function (spec, log) {
return getTime() + ' - ' + log;
};
// add jasmine spec reporter
var reporter = new SpecReporter({
customProcessors: [TimeProcessor]
});
jasmine.getEnv().addReporter(reporter);
var wd = require('wd'),
wdBridge = require('wd-bridge')(wd);
wdBridge.initFromProtractor(exports.config);
},
//seleniumAddress: 'http://localhost:4723/wd/hub' //For mobile devices
seleniumAddress: 'http://localhost:4444/wd/hub' //For desktop
};
一如既往,我们非常感谢您的帮助。
谢谢我自己解决了这个问题。 以下是我所做的: 从上面提到的代码开始,Q是未定义的。 这是因为可以在节点模块文件夹中的wd-bridge.js文件中找到的
var Q=wd.Q
位于需要2个参数的函数中
我更改了dragrator.config.js文件,如下所示:
var Q = wd.Q;
"use strict";
var wd = require('wd');
var protractor = require ('protractor');
var wdBridge = require('wd-bridge')(protractor,wd);
exports.config = {
specs: ['e2e/*.js'],
framework: 'jasmine',
capabilities: {
'appium-version': '',
'platformName': 'Android',
'platformVersion': '6.0',
'deviceName': 'Android Device',
'autoWebView': true,
'app': "C:/src/angular-test/platforms/android/build/outputs/apk/android-debug.apk",
'udid': '',
'fullReset': true,
'browserName': 'chrome'
},
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function () {
}
},
onPrepare: function () {
var DisplayProcessor = require('../node_modules/jasmine-spec-reporter/src/display-processor');
var SpecReporter = require('jasmine-spec-reporter');
function TimeProcessor(options) {
}
function getTime() {
var now = new Date();
return now.getHours() + ':' +
now.getMinutes() + ':' +
now.getSeconds()
}
TimeProcessor.prototype = new DisplayProcessor();
TimeProcessor.prototype.displaySuite = function (suite, log) {
return getTime() + ' - ' + log;
};
TimeProcessor.prototype.displaySuccessfulSpec = function (spec, log) {
return getTime() + ' - ' + log;
};
TimeProcessor.prototype.displayFailedSpec = function (spec, log) {
return getTime() + ' - ' + log;
};
TimeProcessor.prototype.displayPendingSpec = function (spec, log) {
return getTime() + ' - ' + log;
};
// add jasmine spec reporter
var reporter = new SpecReporter({
customProcessors: [TimeProcessor]
});
jasmine.getEnv().addReporter(reporter);
wdBridge.initFromProtractor(exports.config);
},
//seleniumAddress: 'http://localhost:4723/wd/hub' //For mobile devices
seleniumAddress: 'http://localhost:4444/wd/hub' //For desktop
};
它现在工作得很好
注意:如果未找到wd
、wdBridge
或量角器
模块,则不需要全局安装它们(例如,npm install wd
而不是npm install-g wd
)
希望这能帮到你