85. starts-with() function in XPath Expressions (Selenium Java 2026)

Опубликовано: 26 Июль 2026
на канале: QAFox
56
0

*starts-with() XPath Function*

Similar to contains() function
Only checks the starting part of text or attribute value

*Practical Example*

Find element "Practice Automation Here" using starting text or attribute:

//p[starts-with(text(),'Practice')]
//p[starts-with(@id,'p')]

*starts-with()*

Works with partial text or attribute value
Matches only from the beginning (starting position)

*contains()*

Works with partial text or attribute value
Matches from anywhere:

Start
Middle
End