protractor CSS Selectors Select element by an HTML attribute that contains a specified value


Example

To select an element by an HTML attribute that contains a specified value use the css locator pattern [attribute*=value]

//selects the first element with href value that contains'cont'
element(by.css('[href*="cont"]')); 

//selects the first element with tag h1 and class attribute that contains 'fo'
element(by.css('h1[class*="fo"]')); 

//selects all li elements with a title attribute that contains 'users'
element.all(by.css('li[title*='users']'));