Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Selenium test code for browsing back and confirming that page is gone
elementIsVisible (element) {
return this.driver.wait(until.elementIsVisible(element));
}
elementIsNotVisible (element) {
return this.driver.wait(until.elementIsNotVisible(element));
}
const abbyElement = await findByText('Abby'); // Should show editor for new costume
await elementIsVisible(abbyElement);
await new Promise(resolve => setTimeout(resolve, 10000)); // Wait for scroll animation
await driver.navigate().back();
try {
await elementIsVisible(abbyElement); // should throw StaleElementReferenceError
throw 'ShouldNotGetHere'; // eslint-disable-line no-throw-literal
} catch (e) {
expect(e.constructor.name).toEqual('StaleElementReferenceError');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment