Back to Browse

84. contains() function in XPath Expressions - Part 2 (Selenium Java 2026)

29 views
May 15, 2026
9:25

Using contains() Function in XPath (Real-Time Use Case) Another situation where we use the contains() function in real time: * If you want to use the text between the tags of an element in XPath expressions for locating elements, but the text is lengthy, you can use the contains() function. Example: //div[contains(text(), 'sample Text')] * The same applies when locating elements using the value of an attribute. If the attribute value is long, you can use the contains() function. Example: //img[contains(@src, 'college')]

Download

1 formats

Video Formats

360pmp48.2 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

84. contains() function in XPath Expressions - Part 2 (Selenium Java 2026) | NatokHD