难以在chai-webdriver中调试dom选择器

时间:2014-09-29 19:07:45

标签: webdriver mocha chai

我无法弄清楚chai-webdriver是否正常工作。在以下示例中

var webdriver = require('selenium-webdriver');
var chai = require('chai');
var expect = chai.expect;
var chaiWebdriver = require('chai-webdriver');

describe('TWT Plugin', function () {
  var capabilities, driver;
  before(function (done) {
    capabilities = webdriver.Capabilities.chrome();
    capabilities.set("chromeOptions", {
      "excludeSwitches": ["ignore-certificate-errors"]
    });
    driver = new webdriver.Builder().withCapabilities(capabilities).build();
    chai.use(chaiWebdriver(driver));
    return done();
  });

  after(function (done) {
    return driver.quit().then(done);
  });

  it('should be embeddable', function () {
    driver.get('http://localhost:3000/page.html');
    expect("h1").dom.to.contain("text");
  });
});

当我运行mocha test/integration/test_plugin.js --timeout 15000时,我得到AssertionError: expected 'h1' to include 'text',但我没有收到任何解释选择器中包含内容的消息,因此我很难知道是否知道什么匹配。有关如何调试或以其他方式改进的建议吗?

0 个答案:

没有答案