【发布时间】:2016-07-19 04:24:43
【问题描述】:
我有一个带有单个选择框的空白页,其中包含“IP 地址”作为值,我想使用其中一个 zombine.js 选择一个值。
this.browser.fill('select', '223.255.252.246');
失败了^
但这成功了:
this.browser.assert.element('select')
我错过了什么?不是“填充”吗?
这是我的测试
// force the test environment to 'test'
process.env.NODE_ENV = 'test';
// get the application server module
var app = require('../../app');
var http = require('http');
var Browser = require('zombie');
var assert = require('assert');
describe('contact page', function() {
before(function(done) {
this.server = http.createServer(app).listen(3000);// initialize the browser using the same port as the test application
this.browser = new Browser({ site: 'http://localhost:3000' });
this.browser.visit('/', done);
});
it('should load the homepage successfully', function(){
assert.ok(this.browser.success);
});
it('shows a dropdown', function(){
this.browser.assert.element('select')
});
it('selects china, and clicks "start"', function(){
this.browser.fill('select', '223.255.252.246');
});
// ...
after(function(done) {
this.server.close(done);
});
});
【问题讨论】:
标签: forms browser-automation zombie.js