Skip to content

Instantly share code, notes, and snippets.

@lydemann
Created September 11, 2018 13:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lydemann/e63d85f0aac96b3c932aa6226b02becf to your computer and use it in GitHub Desktop.
Save lydemann/e63d85f0aac96b3c932aa6226b02becf to your computer and use it in GitHub Desktop.
import { browser, element } from 'protractor';
import { protractor } from 'protractor/built/ptor';
import { By } from 'selenium-webdriver';
const EC = protractor.ExpectedConditions;
const defaultTimeout = 30000;
export class ElementHelper {
public static getElementOrWait(by: By) {
return browser.wait(EC.visibilityOf(element(by)), defaultTimeout)
.then(() => element(by));
}
public static getElementsOrWait(by: By) {
return browser.wait(EC.visibilityOf(element(by)), defaultTimeout)
.then(() => element.all(by));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment