Jason Corbett
Jason Corbett

Reputation: 109

Testing Angular with Protractor

I am new to Protractor. Can anyone advise me how to deal with Promises and how to know what methods I can call on an element?

For example, I may access an element like: var element = element(by.css('.fileName')); That brings back a promise correct? So, when can I act on it and how do I know what I can actually do to?

In ruby for example, I can do element.methods and see all that I can do for this object.

Please advise

Thanks, JC

Upvotes: 0

Views: 85

Answers (2)

Andres D
Andres D

Reputation: 8900

I have been working on the new protractor documentation. It should be published to http://protractortest.org soon. In the meantime take a look at this:

http://angular.github.io/protractor/#/api?view=ElementFinder

Upvotes: 1

JB Nizet
JB Nizet

Reputation: 691685

See the documentation: https://github.com/angular/protractor/blob/master/docs/api.md#elementfinder

The ElementFinder can be treated as a WebElement for most purposes, in particular, you may perform actions (i.e. click, getText) on them as you would a WebElement.

So, beasically, you can call click() (for example) on the element (the promise) as soon as it's returned. This will tell protractor that, once the element has actually been found, it will have to click on it.

Upvotes: 0

Related Questions