add waitUntilElementIsLocated

This commit is contained in:
Eugenio Romano
2020-11-23 10:11:41 +00:00
parent 46fd14becf
commit fdd842edc0

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { browser, by, element, ElementFinder, protractor } from 'protractor';
import { browser, by, element, ElementFinder, protractor, until } from 'protractor';
import { Logger } from './logger';
export class BrowserVisibility {
@@ -35,6 +35,12 @@ export class BrowserVisibility {
}
}
static async waitUntilElementIsLocated(elementToCheck: ElementFinder, waitTimeout: number = BrowserVisibility.DEFAULT_TIMEOUT): Promise<any> {
Logger.info(`Wait Until Element Is Located ${elementToCheck.locator().toString()} for ${waitTimeout}`);
return browser.wait(until.elementLocated(by.css(css)), waitTimeout, 'Element is not located ' + elementToCheck.locator());
}
static async waitUntilElementIsPresent(elementToCheck: ElementFinder, waitTimeout: number = BrowserVisibility.DEFAULT_TIMEOUT): Promise<any> {
Logger.info(`Wait Until Element Is Present ${elementToCheck.locator().toString()} for ${waitTimeout}`);