我从此函数的标题中得到了错误:
it('should change comment status to SOLVED',
async function() {
await page.click("#view_replies3");
await change_comment_status(page, 5, 'SOLVED');
}).timeout(0);
调试之后,我发现问题出在函数“ change_comment_status()”中:
async function change_comment_status(page, comment_id, status) {
const selector = "input.custom-control-input[name='" +
comment_id.toString() + "']";
page.waitForSelector(selector);
await page.evaluate(selector => {
let element = document.querySelector(selector);
element.click();
}, selector);
}
调用后变量'element'为空
所有元素正确显示在页面中,并且页面看起来在测试运行期间已完全加载
谢谢,伙计们!