html - Selecting Multiple div Nodes with diffrent class with xpath in C# -
i want select div nodes different class xpath.what should do? wrote code, returns error.
htmlweb w = new htmlweb(); string searchresults = "http://www.ask.com/web?q=" + query.querytxt; var hd = w.load(searchresults); var titles = hd.documentnode.selectnodes("//div[contains(@class='web-result ur tsrc')] && //div[contains(@class='web-result ur tsrc_wiki-sa '] && //div[contains(@class='web-result ur tsrc_tube youtube-result ']");
i need these divs
//div[contains(@class='web-result ur tsrc')] //div[contains(@class='web-result ur tsrc_wiki-sa ')] //div[contains(@class='web-result ur tsrc_tube youtube-result ']
this error:
function 'contains' in '//div[contains(@class='web-result ur tsrc')] && //div[contains(@class='web-result ur tsrc_wiki-sa '] && //div[contains(@class='web-result ur tsrc_tube youtube-result ']' has invalid number of arguments.
in xpath
contains()
function works ,
compare value instead of =
. try below correct xpath
:-
//div[contains(@class, 'web-result ur tsrc')] //div[contains(@class, 'web-result ur tsrc_wiki-sa ')] //div[contains(@class, 'web-result ur tsrc_tube youtube-result ')]
hope helps...:)
Comments
Post a Comment