The text is as:
text1
text2
How can I specify this text in xpath. I tried:
.//*[@id='someid']//h6[text() ='text1text2]
.//*[@id='someid']//h6[text() ='text1\ntext2]
.//*[@id='someid']//h6[text() ='text1 text2]
None of them worked
Use .//*[@id='someid']//h6[. = 'text1 text2']
. This assumes you are writing the path inside of XSLT or XForms where you can use
to escape a new line character. If you are not using XSLT you might want to tell us in which host language (e.g. PHP, C#, Java) you use XPath.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With