From b69550f5b9280889dafbdfd148166070526af35e Mon Sep 17 00:00:00 2001 From: LouisLam Date: Thu, 7 Oct 2021 17:01:17 +0800 Subject: [PATCH] Improve the test --- test/test.spec.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/test.spec.js b/test/test.spec.js index e1fd289..079b472 100644 --- a/test/test.spec.js +++ b/test/test.spec.js @@ -223,12 +223,14 @@ async function login(username, password) { } async function click(page, selector, elementIndex = 0) { + await page.waitForSelector(selector); return await page.evaluate((s, i) => { return document.querySelectorAll(s)[i].click(); }, selector, elementIndex); } async function input(page, selector, text) { + await page.waitForSelector(selector); const element = await page.$(selector); await element.click({ clickCount: 3 }); await page.keyboard.press("Backspace");