Skip to content

Instantly share code, notes, and snippets.

@qswitcher
Created July 14, 2020 17:21
Show Gist options
  • Save qswitcher/4451e21009dcc084b93a5ba303c2abbe to your computer and use it in GitHub Desktop.
Save qswitcher/4451e21009dcc084b93a5ba303c2abbe to your computer and use it in GitHub Desktop.
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