【问题标题】:zombie.js how do i select from a dropdown僵尸.js 我如何从下拉列表中选择
【发布时间】: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


    【解决方案1】:

    答案是使用“选择”,例如:

    this.browser.select('select', '223.255.252.246');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-11
      • 2022-01-24
      相关资源
      最近更新 更多