I'm currently writing some Protractor tests for an app. But in the app i'm using controller as syntax as the pieces I want to work on are components. The problem is that when i use the selector of "" $ctrl.functionName"" it's giving me an illegal selector statement.
Anyone have any ideas about this?
let btn = $$("button[ng-click^=$ctrl.initRequest].secondary.bf-btn");
expect(btn.isDisplayed()).toBe(true);
The error message is
Failed: invalid selector: An invalid or illegal selector was specified
If you cannot assign a meaningful id
or other attribute to the element, you need to fix your current selector. At the very least, there should be quotes around the ng-click
value:
button[ng-click^='$ctrl.initRequest'].secondary.bf-btn
Note that a slightly better version, that would also not require quotes, would be to use a partial match:
button[ng-click*=initRequest].secondary.bf-btn
And, see if you can drop the questionable classes and have just:
button[ng-click*=initRequest]