3

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? :-)

1 Answer 1

4

If you use latest protractor, try:

MyErrors.elementNotFound(elementFinder.locator().toString())

More detail, please look locator() api.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.