binding locator in Protractor

QAinCharge picture QAinCharge · Jan 8, 2015 · Viewed 15.2k times · Source
I have a problem with ng-binding locator in Protractor code:    
<h1 class="blackText ng-binding">some_link</h1>

I tried to use:
element(by.binding('some_link')).click();

but it's not finding anything.

This works:
element(by.cssContainingText('.ng-binding', 'some_link')).click();

but I would like to use binding locator.

Any ideas ?

Answer

hankduan picture hankduan · Jan 8, 2015

See this for an example: https://docs.angularjs.org/api/ng/directive/ngBind

Note that in the example you're doing element(by.binding('name')), and not element(by.binding('Whirled')). Basically don't use what the binding evaluates to, but the binding's name.