您好,我正在尝试运行测试用例以打开Google页面,然后单击搜索 下面是测试用例中的代码,当我尝试执行测试用例时。屏幕快照已附着,我正面临错误
const { describe, it, beforeEach, afterEach } = require('mocha');
const Page = require('../lib/homePage');
const chai = require('chai');
const expect = chai.expect;
const chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
process.on('unhandledRejection', () => {});
(async function example() {
try {
describe('Google search automated testing', async function() {
this.timeout(50000);
let driver, page;
beforeEach(async() => {
page = new Page();
driver = page.driver;
await page.visit('https://www.google.com/');
});
afterEach(async() => {
await page.quit();
});
it('find the input box and google search button', async() => {
const result = await page.findInputAndButton();
console.log(result);
expect(result.inputEnabled).to.equal(true);
expect(result.buttonText).to.include('Google');
});
it('put keyword in search box and click search button', async() => {
const result = await page.submitKeywordAndGetResult();
expect(result.length).to.be.above(10);
});
});
} catch (ex) {
console.log(new Error(ex.message));
} finally {
}
})();
/i.stack.imgur.com/SD9Or.jpg