Following is html snippet element
<a ng-click="nodes.setViewType('tiles',true)"> <span class="fa fa-check Tick-Inactive" ng-class="nodes.viewType == 'tiles'? 'Tick-Active':'Tick-Inactive'" style=""></span> Tile View </a>
Trying to use ng-click or ng-class in locators using java script escape characters. But it showing invalid or illegal selector was specified
element(by.xpath("//a[contains(@ng-click,'nodes.setViewType(\'tiles\',true)')]")); element(by.css("span[ng-class^=nodes.viewType == \'tiles\']")); element(by.xpath("//a[contains(@ng-click,'nodes.setViewType%28%27tiles%27%2Ctrue%29')]"));
This error message...
invalid or illegal selector was specified
...implies that the Locator Strategy you have constructed was not a valid locator.
To locate the element with text as Tile View you can use the following xpath :
Note : As the element is an Angular element to interact with it you have to induce a waiter for the element to be clickable.
©2020 All rights reserved.