按精確的 HTML 屬性值選擇元素
要通過精確的 HTML 屬性選擇元素,請使用 css 定位器模式 [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"]'));