InvalidSelectorError: invalid selector: Unable to locate an element with the xpath expression

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

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.css("span[ng-class^=nodes.viewType == \'tiles\']"));




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.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.