xpath help can't get the text?
I am unable to get the text from this website: http://mp3bear.com...so now I just want to get the title of the song that is 开发者_开发百科displayed on it.. here is what i wrote as the code:
//table/tr[2]/td[2]
so now I want to get second row from second column... it doesn't display anything.... is there any thing special when
I can't find any table element on this site, the tables are constructed with divs.
Therefore the expression for the second row of the second column of the table is.
//div[@id='listwrap']/div[3]/div[2]
There are some xpath implementations that don't allow indexing of child elements in this manner. In this case you could use
//div[@id='listwrap']/div[position()='3']/div[position()='2']
Edit:
In that case you need this expression:
//div[@id='listwrap']/div[3]/div[2]/a/text()
as the title is contained in a 'a' element and you use the xpath function text() to get the text value of the 'a' element
tested in firepath.
精彩评论