XPath Text(): Enhance your skills by practicing XPath Text() syntax with our given sample HTML codes and interactive exercises, designed to help you master selecting elements in HTML and XML documents.

Boost Your Skills: Practice XPath Text() Syntax with easy Exercises.


Home → Practice 5

Next Exercise >>
Step 1: Read XPath Question → Step 2: Check HTML Source Code → Step 3: Enter XPath Syntax in O/P Box

XPath Exercise 5

Q1. Find Coffee Item with Text() function

Q2. Find Tea Item with Text() function

Q3. Find Milk Item with Text() function

Q4. Find Email with Text() function

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 O/P Box

Enter XPath Syntax 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. Please use the Social Media button on the right side to help this website grow.