protractor CSS Selectors Select element by an exact HTML attribute value


Example

To select an element by an exact HTML attribute use the css locator pattern [attribute=value]

//selects the first element with href value '/contact'
element(by.css('[href="/contact"]')); 

//selects the first element with tag option and value 'foo'
element(by.css('option[value="foo"]')); 

//selects all input elements nested under the form tag with name attribute 'email'
element.all(by.css('form input[name="email"]'));