Created
July 14, 2020 17:21
-
-
Save qswitcher/4451e21009dcc084b93a5ba303c2abbe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function waitForSearchResults() { | |
// check if oops page, if oops page, refresh | |
try { | |
return await (await browser.$(selectors.hit)).waitForExist(10000); | |
} catch (e) { | |
// check if it's an oops page | |
if (await isOopsPage()) { | |
// there was an oops page, refresh the page | |
console.error('Oops page, refreshing page....'); | |
await browser.refresh(); | |
// wait again for hits to load | |
return await (await browser.$(selectors.hit)).waitForExist( | |
10000 | |
); | |
} | |
throw e; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment