无法在 Android 模拟器上运行量角器脚本 [英] Couldn't run protractor scripts on Android emulator
本文介绍了无法在 Android 模拟器上运行量角器脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用 Appium 在 android 模拟器上执行 protractor 脚本,但是当我在终端上点击:"protractor conf.js "时,问题模拟器没有启动.测试在windows的chrome浏览器中通过,而不是模拟器中的浏览器.我要添加其他功能吗?或者我应该更改基本网址?
I want to execute protractor script on android emulator using Appium, but the problem emulator isn't launched when i tap: " protractor conf.js " on terminal. The test is passed in chrome browser of windows instead of browser in the emulator. Shall i add other capabilities ? or i should change the base url ?
// An example configuration file.
exports.config = {
seleniumAddress: 'http://localhost:4733/wd/hub',
specs: ['todo-spec.js'],
directConnect: true,
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome',
'device': 'android',
'deviceName' : '5554:AndroidDevice',
device: 'android',
'appium-version': "1.4.16.1",
deviceName : '5554:AndroidDevice',
},
// Framework to use. Jasmine is recommended.
framework: 'jasmine',
baseUrl: 'http://127.0.0.1:5858',
// Spec patterns are relative to the current working directly when
// protractor is called.
// Options to be passed to Jasmine.
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
//------------------todo-spec.js----------------------------------------
describe('angularjs homepage todo list', function() {
it('should add a todo', function() {
browser.get('https://angularjs.org');
element(by.model('todoList.todoText')).sendKeys('write first protractor test');
element(by.css('[value="add"]')).click();
var todoList = element.all(by.repeater('todo in todoList.todos'));
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write first protractor test');
// You wrote your first test, cross it off the list
todoList.get(2).element(by.css('input')).click();
var completedAmount = element.all(by.css('.done-true'));
expect(completedAmount.count()).toEqual(2);
});
});
推荐答案
删除 directConnect
以允许它使用 selenium 服务器:
Remove the directConnect
to allow it to use the selenium server:
// An example configuration file.
exports.config = {
seleniumAddress: 'http://localhost:4733/wd/hub',
specs: ['todo-spec.js'],
directConnect: true, <-- remove this line
...
}
一个应该有助于澄清问题的相关主题:
A related topic that should help clearing things up:
这篇关于无法在 Android 模拟器上运行量角器脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文