**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
Download
0 formats
No download links available.
85. starts-with() function in XPath Expressions (Selenium Java 2026) | NatokHD