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 restriction on tag.
element(by.xpath('//div[@custom-attribute]'))
As oppose to above example, I don't want to put restriction on tag since we have different tags with the same custom attribute. I'd like locate all elements with the attribute regardless of tag. Is that possible?
You can use a CSS selector locator:
Or, via the
$$
shortcut:[custom-attribute]
is an attribute selector that would match any element havingcustom-attribute
attribute.