S
S
sanphir2016-07-13 10:45:41
Angular
sanphir, 2016-07-13 10:45:41

How to get value from promise synchronously?

You need to write a method that would return the state of the element true/false

IsValid():boolean {
        return element(by.id(this.id)).isDisplayed();
}

isDisplayed returns a promise on how to get a value from it and return it to IsValid.
Simply put, how to make asynchronous synchronous?
Do not offer alternative solutions, that's how it should be.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2016-07-13
@sanphir

how to make asynchronous synchronous?

No way. You can use async/await if the promises seem verbose, but that will only change the syntax, not the point.
Anything further down the stack from an async function must be async, even if you really, really want it to be otherwise.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question