I want to create a generic function that notifies on errors
I can't seem to find a way to get the css selector from an ElementFinder member
Here's my function:
static waitForElementToExist(elementFinder: ElementFinder): SeleniumPromise<any> {
return browser.wait(until.presenceOf(elementFinder),
jasmine.DEFAULT_TIMEOUT_INTERVAL,
MyErrors.elementNotFound(<get element selector string>));
};
so I can return a meaningful error like:
could not found the element '.class-selector'
can anyone point me to the right direction please? :-)
If you use latest protractor, try:
MyErrors.elementNotFound(elementFinder.locator().toString())
More detail, please look locator() api.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With