Reputation: 109
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
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
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