const noofElements = driver.findElements(By.css("#foo")).then(elements => assert.strictEqual(elements.length, 0));
Or
const noofElements = await driver.findElements(By.css("#foo")).length
assert.strictEqual(elements.length, 0));
You should assert it inside the then or use await ,
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…