What is the proper way to use descendant in XPath -
i trying find div elements have attribute widget-name , descendant span tag have title attribute. this trying. //div[@widget-name , descendant::span[@title]]" this seems work missing 1 element in nodes collection returns. never mind. this needed: //div[@widget-name , descendant::span[@class='title']] ok - take back. not complete answer. trying tweak returns except title not equal text: //div[@widget-name , descendant::span[@class='title' , [text()[contains(., '{sometexttokeep}' anyone see why invalid xpath? final answer is: //div[@widget-name , descendant::span[@class='title' , text()[not(contains(., 'sometexttokeep'))]]]"