Skip to content

Instantly share code, notes, and snippets.

@mattdhorstman
Created April 29, 2021 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattdhorstman/ea24ddb70b80a52591b7e8fa909ff66b to your computer and use it in GitHub Desktop.
Save mattdhorstman/ea24ddb70b80a52591b7e8fa909ff66b to your computer and use it in GitHub Desktop.
Protractor async/await
Given('test', async () => {
let nav = element.all(by.css('.nav-title'));
console.log(`Length: ${await nav.count()}`); //correct output
for (let i = 0; i < (await nav.count()); i++) {
console.log(`Nav${i}: ${await nav.get(i).getText()}`); //correct output
}
let staticIpNav = element(by.cssContainingText('.nav-title', 'STATIC-IP'));
await staticIpNav.click();
console.log('after click'); //correct output
console.log('before let'); //correct output
let reportsNav = element.all(by.css('.nav-item'));
console.log(`Length: ${await reportsNav.count()}`); // no ouput
for (let i = 0; i < (await reportsNav.count()); i++) {
console.log(`Nav${i}: ${await reportsNav.get(i).getText()}`); // no output
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment