gpt4 book ai didi

node.js - chai-webdriver ( Node ) ... 描述不是一个函数

转载 作者:太空宇宙 更新时间:2023-11-04 02:21:46 24 4
gpt4 key购买 nike

我不断收到描述不是函数的错误。我该如何解决这个问题

// Require chai.js expect module for assertions
var chai = require('chai');
var expect = require('chai').expect;
chai.use = require ('chai-as-promised')
// Application Server
var serverUri = '0.0.0.0:3000';

// Official selenium webdriver testing setup
var webdriver = require('selenium-webdriver');

describe('basic test', function () {
var driver;
before(function(){
// Start of test use this
driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.chrome()).
build();
console.log("Selenium Webdriver Chrome Started");
});

after(function(){
// End of test use this.
driver.quit();
});

it('should be on correct page', function (done) {
this.timeout(10000);
driver.get(serverUri);
driver.getTitle().then(function(title) {
expect(title).to.equal('Some String Here');
done();
console.log("Selenium Webdriver Chrome Shutdown");
})
});
});

运行后得到的错误是:

describe is not a function

最佳答案

您忘记需要 mocha(假设您安装了它)..

尝试添加

const { 描述、it、之前、之后 } = require('mocha');

关于node.js - chai-webdriver ( Node ) ... 描述不是一个函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33016016/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com