XPath Contains(): Enhance your skills by practicing XPath Contains() 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 Contains() Syntax with easy Exercises.

Home->Practice 7

  Next Exercise >>
Please Follow Step 1: Read XPath Question >>Step 2: Check HTML Source Code >>Step3: Enter XPath Syntax in O/P Box
XPath Exercise 7

Q1. Find header1 with Contains()

Q2. Find header2 with Contains()

Q3. Find header3 with Contains()

Q4. Find header4 with Contains()

Q5. Find Email with Contains()

Q6. Find Name with Contains()

Q7. Find hyperlink with Contains()

Q8. Find Red Paragraph with Contains()

HTML Source document
         <h1 id="h1" name="header1">Heading 1 </h1>
         <h2 id="h2" name="header2">Heading 2 </h2>
         <h3 id="h3" name="header3">Heading 3 </h3>
         <h4 id="h4" name="header4">Heading 4 </h4>
         <a href="https://thetestdata.com">Visit Thetestdata </a> 
<label class="form-label" id="userEmail-label" name="Email">Email</label>

<p class="form-para" id="userEmail-para" name="Email">Name</p>
     <p style="color:red;">This is a red paragraph.</p> 

XPath O/P Box

Enter XPath Syntax here:   

XPath Tips and Syntax For This Page Exercise :

Using contains()





The contains() function in XPath can be used to test if a string contains a specified substring.

We would love to hear your thoughts, suggestions, concerns or problems with anything so we can improve. Request you to please use Social Media button in Right Side for this website growth.