以下代码执行单元测试,即它加载了页面URL,并在那里等待直到超时,但是退出并显示错误Error: Timeout of 65000ms exceeded
,而没有截图。
describe('initial test', function () {
let browser
let page
before(async function () {
browser = await puppeteer.launch({headless: false})
page = await browser.newPage()
await page.goto('base url')
})
it('should go to new page', async function(){
this.timeout(65000);
await page.goto('url', {
timeout : 0,
waitLoad: false,
})
await page.waitForSelector('selector name', {timeout: 1000})
await page.waitFor(5000)
await page.screenshot({ path: 'menu.png' })
})