0

Is something like following possible?

const span= fixture.debugElement.query(By.css('span:containts("some text")'));

or is there something like a .cssContainingText like with protractor? As a css selector or some other way.

aycanadal
  • 1,106
  • 2
  • 15
  • 42

1 Answers1

0

How about this approach:

const spans = fixture.debugElement.queryAll(By.css('span'));
const span = spans.find(span => span.nativeElement.textContent.includes('some text'))
zmag
  • 7,825
  • 12
  • 32
  • 42