मिलान मैं एक लिंक जिसका class="watchListItem"
, span="icon icon_checked"
, और h3="a test"
चयन करने के लिए xpath का उपयोग करना चाहते द्वारा माता पिता वर्ग प्राप्त करें। मैं मिलान लिंक और अवधि, या लिंक और एच 3 प्राप्त करने के लिए xpath का उपयोग कर सकता हूं, लेकिन लिंक, अवधि और एच 3 नहीं।Xpath - दो बच्चे नोड्स
यहाँ मैं क्या कोशिश की है:
//*[@class = 'watchListItem']/span[@class = 'icon icon_checked']
//*[@class= 'watchListItem']/h3[text()='AA']
मैं कुछ इस तरह की तलाश में हूँ:
//*[@class = 'watchListItem']//*[span[@class = 'icon icon_checked'] and h3[text()='AA']]
<li>
<a class="watchListItem" data-id="thisid1" href="javascript:void(0);">
<span class="icon icon_checked"/>
<h3 class="itemList_heading">a test</h3>
</a>
</li>
<li>
<a class="watchListItem" data-id="thisid2" href="javascript:void(0);">
<span class="icon icon_unchecked"/>
<h3 class="itemList_heading">another test</h3>
</a>
</li>
<li>
<a class="watchListItem" data-id="thisid3" href="javascript:void(0);">
<span class="icon icon_checked"/>
<h3 class="itemList_heading">yet another test</h3>
</a>
</li>
मैं एक ऐसी ही जवाब के साथ आया था, लेकिन मैं '.// span'' बच्चे :: span' के बजाय इस्तेमाल किया। क्या आप जानते हैं कि कोई अंतर क्या है? क्या 'बच्चे' केवल प्रत्यक्ष बच्चों का चयन करेगा या क्या यह किसी भी वंशज का चयन करेगा? यह नहीं कि मामले में यह महत्वपूर्ण है। बस उत्सुक। – Ben
:: वंशज यह करता है, :: बच्चे को केवल तत्काल बच्चों का चयन करना चाहिए :) @ बेन –
@बेन हालांकि .// वंश न केवल बच्चों का चयन करेगा। –