Skip to content Skip to sidebar Skip to footer

Locate Element By A Presence Of A Custom Attribute

How do you locate all those elements that has particular custom attribute in Protractor? I found similar questions on Stackoverflow and on net, but they uses xpath which puts restr

Solution 1:

You can use a CSS selector locator:

element.all(by.css('[custom-attribute]'));

Or, via the $$ shortcut:

$$('[custom-attribute]');

[custom-attribute] is an attribute selector that would match any element having custom-attribute attribute.

Post a Comment for "Locate Element By A Presence Of A Custom Attribute"