Reputation: 21129
In Protractor, the xpath contains[.,'']
works all time instead of CSS's contains()
feature; is there any cause for such broken functionality? or any tweak to implement it?
Upvotes: 1
Views: 83
Reputation: 42528
The pseudo class contains
is not a CSS feature. It's implemented by external libraries like JQuery or Mootools. To get an element by text, use the locator by.cssContainingText
:
var elem = element(by.cssContainingText('div.left', 'my text'));
Upvotes: 4