Reputation: 27
I have a drop down box and I want to locate element by span value. How to do this? I don't want to use xpath as it is not a best practice.
Upvotes: 1
Views: 5960
Reputation: 13712
Option 1
element(by.cssContainingText('span.mat-option-text', '100'))
Option 2
element(by.xpath('//span[@class="mat-option-text"][text()="100"]'))
Upvotes: 4