Home->Practice 6 |
Next Exercise >> | |
---|---|---|
Please Follow Step 1: Read XPath Question >> | Step 2: Check HTML Source Code >> | Step3: Enter XPath Syntax in O/P Box |
Q1. Find header1 with And Operator
Q2. Find header2 with And Operator
Q3. Find header3 with And Operator
Q4. Find header4 with And Operator
Q5. Find header1 with OR Operator
Q6. Find header2 with OR Operator
Q7. Find header3 with OR Operator
Q8. Find header4 with OR Operator
Q9. Find Email with And Operator
Q10. Find Email with OR Operator
Q11. Find Name with And Operator
Q12. Find Name with OR Operator
<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> <label class="form-label" id="userEmail-label" name="Email"> Email </label> <p class="form-para" id="userEmail-para" name="Email"> Name </p>
Name
Using AND
//HTMLtag[@attribute_name1='attribute_value1' and @attribute_name2='attribute_value2] or //*[@attribute_name1='attribute_value1' and @attribute_name2='attribute_value2] e.g //input[@id='Email' and @name='password']
The and operator in XPath is used to combine two or more conditions. The and operator returns true only if all of the conditions it combines are true.
Using OR
//HTMLtag[@attribute_name1='attribute_value1' or @attribute_name2='attribute_value2] or //*[@attribute_name1='attribute_value1' or @attribute_name2='attribute_value2] e.g //input[@id='Email' or @name='password']