XPath Practice: Mastering XPath Expressions for Effective Web Automation using Text() Function

Test Your Skills with this Fun and Interactive Game


Home->Practice 5

Next
HTML Source document
         <h1 id="h1" name="header">Heading 1 </h1>
         <ul>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul> 

<label class="form-label" id="userEmail-label">
Email
</label>
        
        
XPath Exercise 5

Q1. Find Coffee Item with Text() function

Q2. Find Tea Item with Text() function

Q3. Find Milk Item with Text() function

Q3. Find Email with Text() function

XPath O/P

Enter XPath Input here:   

XPath Tips and Syntax For This Page Exercise :

Using text()

     //*[text()='testdata']

The text() function in XPath can be used to select the text content of an element.

We would love to hear your thoughts, suggestions, concerns or problems with anything so we can improve!