Set maxFindTextAttempts as a function argument

This commit is contained in:
Himanshu Mishra
2020-05-05 20:38:57 +09:00
parent 82b6f1e4cb
commit 5d5d093b20
+1 -2
View File
@@ -95,7 +95,7 @@ async function waitForPageWithText(
browser,
path,
text,
{ intervalMs = 1000, maxLoadAttempts = 240 } = {},
{ intervalMs = 1000, maxLoadAttempts = 240, maxFindTextAttempts = 3 } = {},
) {
let loadAttempts = 0;
for (;;) {
@@ -118,7 +118,6 @@ async function waitForPageWithText(
}
// The page may not be fully loaded and hence we need to retry.
const maxFindTextAttempts = 3;
let findTextAttempts = 0;
const escapedText = text.replace(/"/g, '\\"');
for (;;) {