0 votes
in Xpath Interview Questions by
What is Normalize space in Xpath?

1 Answer

0 votes
by
Normalize space is used to remove the empty spaces at the ends of the string while using xpath.

normalize-space(string)

str = "   cher      cher     tech     "

normalize-space(string) // outputs "cher cher tech"​

With code example

html code

<label>    who cares         about spaces   </label>

xpath

//label[normalize-space(text())='who cares about spaces']

Related questions

0 votes
asked Jul 26, 2021 in Xpath Interview Questions by SakshiSharma
0 votes
asked Jul 24, 2021 in Xpath Interview Questions by Robindeniel
...