Rameshwar
Rameshwar

Reputation: 551

XPath for text is not working

DOM

I want to locate label by using its text property.

I tried

//label[normalize-space(text())='Only allow resources who are']
//label[contains(normalize-space(text()),'Only allow resources who are')]

But none of them work.

Upvotes: 3

Views: 452

Answers (1)

kjhughes
kjhughes

Reputation: 111521

This XPath,

//label[normalize-space()='Only allow resources who are']

will select all label elements whose space-normalized string value is the targeted text.

See also

Upvotes: 4

Related Questions